Given
String
String
Constraints
The sum of the lengths of all strings will be at most
All strings will only contain lowercase letters.
Input Specification
The first line contains a single positive integer,
The next
Output Specification
Output the lexicographically largest common subsequence. If no nonempty subsequence exists, output -1
.
Sample Input 1
2
quantum
xyene
Sample Output 1
n
Sample Input 2
1
cba
Sample Output 2
cba
Sample Input 3
3
a
ab
c
Sample Output 3
-1
Comments