Transformations

No attempts yetTime limit1sMemory limit128 MB

Problem

You are given two words uu and vv built only from the letters a and b. Your goal is to turn the word uu into the word vv using only the following swap operation:

  • In the first word, pick one occurrence of the substring ab and one occurrence of the substring ba whose positions do not overlap (they are disjoint), then swap the two fragments. After the swap, the place that held ab holds ba, and the place that held ba holds ab.

Decide whether, by performing a finite number of such operations, uu can be turned into vv.

Input

The first line contains an integer nn (2n10000002 \le n \le 1\,000\,000), the length of the words.

Each of the next two lines contains a string of nn characters, each a or b. The first line is the word uu and the second line is the word vv. You may assume the two words are different.

Output

Print TAK (yes) on a single line if uu can be turned into vv using only the swap operation, and NIE (no) otherwise.