A DNA string uses A, C, G, T. Apply these bidirectional substring replacements:
A
C
G
T
For NNN strings, output whether each pair can transform from the first to the second.
Line 1: NNN (2≤N≤1002 \le N \le 1002≤N≤100). Next NNN DNA strings (length ≤50 000\le 50\,000≤50000).
NNN lines of NNN 0/1 chars; 1 at (i,j)(i,j)(i,j) means string iii can become string jjj.
0/1
1