Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings *a* and *b* of equal length are called equivalent in one of the two cases: 
 1.  They are equal. 1.  If we split string *a* into two halves of the same size *a*<sub class="lower-index">1</sub> and *a*<sub class="lower-index">2</sub>, and string *b* into two halves of the same size *b*<sub class="lower-index">1</sub> and *b*<sub class="lower-index">2</sub>, then one of the following is correct: <ol> <li> *a*<sub class="lower-index">1</sub> is equivalent to *b*<sub class="lower-index">1</sub>, and *a*<sub class="lower-index">2</sub> is equivalent to *b*<sub class="lower-index">2</sub> 1.  *a*<sub class="lower-index">1</sub> is equivalent to *b*<sub class="lower-index">2</sub>, and *a*<sub class="lower-index">2</sub> is equivalent to *b*<sub class="lower-index">1</sub> 
As a home task, the teacher gave two strings to his students and asked to determine if they are equivalent.

Gerald has already completed this home task. Now it's your turn!
The first two lines of the input contain two strings given by the teacher. Each of them has the length from 1 to 200 000 and consists of lowercase English letters. The strings have the same length.
def sort_string(x):
    size = len(x)
    if size % 2 != 0:
        return x
    mid = size // 2
    x1 = sort_string(x[:mid])
    x2 = sort_string(x[mid:])
    if x1 > x2: return x2 + x1
    return x1 + x2

x = input()
y = input()

is_equivalent = sort_string(x) == sort_string(y)

if is_equivalent: print("YES")
else: print("NO")