Vlatko likes to play with integer arrays. He wrote two arrays of
Vlatko wonders if it's possible to replace all variables with some integer values in such a way that the two arrays become equal. Two arrays are considered equal if the numbers on the same positions in the arrays are equal.
Input Specification
The first line contains a positive integer
The second line contains
The third line contains
Each element in both arrays can either be:
- a positive integer less than
or - a sequence of lowercase letters of the English alphabet (no longer than
characters) which represents a variable.
Output Specification
If it's possible to replace all variables with integer values in a way that the two arrays become equal, print DA
(Croatian for yes). Otherwise print NE
(Croatian for no).
Scoring
In test cases worth
In test cases worth additional x
and y
. It's possible that the variables appear multiple times in both arrays.
Sample Input 1
3
3 1 2
3 1 x
Sample Output 1
DA
Sample Input 2
4
4 5 iks ipsilon
1 iks 3 iks
Sample Output 2
NE
Sample Input 3
5
x 3 x y 3
x y 2 z 3
Sample Output 3
DA
Explanation for Sample Output 3
By introducing substitutions
Comments
Whoever added that leading zero in the input does not like to see people happy