Giving a challenge involving a Star Trek reference just after May the 4th may be frowned upon, but here goes.
You, Luke, Anakin, Palpatine, Yoda and Han Solo are involved in an insane tournament of Rock, Paper, Scissor, Lizard, Spock.
The catch here is that you are only allowed to use a fixed order of moves. If your order is "R", Then you have to use Rock, until you lose or win against everyone. If your order is RRV, then you have to use 2 Rocks followed by a Spock and keep repeating until you have won or lost.
Luke, Anakin, Palpatine, Yoda and Han Solo have submitted their respective orderings and you being an expert hacker got your hands on each of their orderings!
With this knowledge, you are to design your ordering for the tournament. Since everyone wants to win, you want to create an ordering such that you win the tournament by beating everyone. But this may not be possible under all circumstances.
Incase there is a possible winning order, print that out. If there is no possible way for you to win, print out -1 (or 0 or False or "impossible")
Input: a list of 5 orders
Output: a single order or -1
Sample Input 1
R
P
S
L
V
Sample Output 1
-1
Explanation 1
No matter what you play in your first move, there will be at least one person who beats you, hence it is not possible for you to win.
Sample Input 2
RPS
RPP
R
SRR
L
Sample Output 2
RPSP
Explanation 2
Once you play Rock in your first move, you end up beating "L" and "SRR" and tie against the rest. This is because Lizard and Scissors lose to Rock. When you play Paper next, you will beat "R" and tie against the remaining 2. This is because Rock loses to Paper. When you play Scissors next, you will win against "RPP" as Scissor beats Paper.
Finally, you will beat "RPS" with your Paper as Paper beats Rock.
Here are a list of notations (you may use any 5 literals, but please specify in your answer):
R : Rock
P : Paper
S : Scissor
L : Lizard
V : Spock
Here is a list of all possible outcomes:
winner('S', 'P') -> 'S'
winner('S', 'R') -> 'R'
winner('S', 'V') -> 'V'
winner('S', 'L') -> 'S'
winner('S', 'S') -> Tie
winner('P', 'R') -> 'P'
winner('P', 'V') -> 'P'
winner('P', 'L') -> 'L'
winner('P', 'S') -> 'S'
winner('P', 'P') -> Tie
winner('R', 'V') -> 'V'
winner('R', 'L') -> 'R'
winner('R', 'S') -> 'R'
winner('R', 'P') -> 'P'
winner('R', 'R') -> Tie
winner('L', 'R') -> 'R'
winner('L', 'V') -> 'L'
winner('L', 'S') -> 'S'
winner('L', 'P') -> 'L'
winner('L', 'L') -> Tie
winner('V', 'R') -> 'V'
winner('V', 'L') -> 'L'
winner('V', 'S') -> 'V'
winner('V', 'P') -> 'P'
winner('V', 'V') -> Tie
This is code-golf, so fewest bytes win.
P.S: Let me know if you need more test cases.