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. 
  2. If we split string a into two halves of the same size a1 and a2, and string b into two halves of the same size b1 and b2, then one of the following is correct: 
    1. a1 is equivalent to b1, and a2 is equivalent to b2
    2. a1 is equivalent to b2, and a2 is equivalent to b1



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!

Input

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.

Output

Print "YES" (without the quotes), if these two strings are equivalent, and "NO" (without the quotes) otherwise.

Examples

Input

aaba
abaa


Output

YES


Input

aabb
abab


Output

NO

Note

In the first sample you should split the first string into strings "aa" and "ba", the second one — into strings "ab" and "aa". "aa" is equivalent to "aa"; "ab" is equivalent to "ba" as "ab" = "a" + "b", "ba" = "b" + "a".

In the second sample the first string can be splitted into strings "aa" and "bb", that are equivalent only to themselves. That's why string "aabb" is equivalent only to itself and to string "bbaa".
#!/usr/bin/env python
# 560D_strings.py - Codeforces.com 560D Strings program
#
# Copyright (C) 2015 Sergey

"""
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!
Input

The first two lines of the input contain two strings given by the teacher.
Each of them has the length from 1 to 200000 and consists of lowercase
English letters. The strings have the same length.

Output

Print "YES" (without the quotes), if these two strings are equivalent,
and "NO" (without the quotes) otherwise.

"""

# Standard modules
import unittest
import sys

# Additional modules


###############################################################################
# Strings Class
###############################################################################


class Strings:
    """ Strings representation """

    def __init__(self, args):
        """ Default constructor """

        self.stra, self.strb = args

    def splitcheck(self, a, b):
        la = len(a)
        lb = len(b)
        if la != lb:
            return 0
        if a == b:
            return 1
        if la % 2 == 1 or lb % 2 == 1:
            return 0

        a1, a2 = a[la//2:], a[:la//2]
        b1, b2 = b[lb//2:], b[:lb//2]
        if self.splitcheck(a1, b1) and self.splitcheck(a2, b2):
            return 1
        if self.splitcheck(a1, b2) and self.splitcheck(a2, b1):
            return 1
        return 0

    def calculate(self):
        """ Main calcualtion function of the class """

        result = self.splitcheck(self.stra, self.strb)

        return str("YES" if result else "NO")


###############################################################################
# Helping classes
###############################################################################


###############################################################################
# Strings Class testing wrapper code
###############################################################################


def get_inputs(test_inputs=None):

    it = iter(test_inputs.split("\n")) if test_inputs else None

    def uinput():
        """ Unit-testable input function wrapper """
        if it:
            return next(it)
        else:
            return sys.stdin.readline().rstrip()

    # Getting string inputs. Place all uinput() calls here
    stra = uinput()
    strb = uinput()
    # Decoding inputs into a list
    return [stra, strb]


def calculate(test_inputs=None):
    """ Base class calculate method wrapper """
    return Strings(get_inputs(test_inputs)).calculate()


###############################################################################
# Unit Tests
###############################################################################


class unitTests(unittest.TestCase):

    def test_Strings_class__basic_functions(self):
        """ Strings class basic functions testing """

        # Constructor test
        d = Strings(["aaaabbbb", "ababbaba"])
        self.assertEqual(d.stra, "aaaabbbb")

        self.assertEqual(d.splitcheck("a", "a"), 1)
        self.assertEqual(d.splitcheck("ab", "a"), 0)
        self.assertEqual(d.splitcheck("abb", "aba"), 0)
        self.assertEqual(d.splitcheck("ab", "ba"), 1)
        self.assertEqual(d.splitcheck("abcdefgh", "efhgdcba"), 1)

    def test_sample_tests(self):
        """ Quiz sample tests. Add \n to separate lines """

        # Sample test 1
        test = "aaba\nabaa"
        self.assertEqual(calculate(test), "YES")
        self.assertEqual(get_inputs(test)[0], "aaba")
        self.assertEqual(get_inputs(test)[1], "abaa")

        # Sample test 2
        test = "aabb\nabab"
        self.assertEqual(calculate(test), "NO")

        # Sample test 3
        test = "abddbbdd\nddbbddba"
        self.assertEqual(calculate(test), "YES")

        # My test
        test = "aabb\nbbaa"
        self.assertEqual(calculate(test), "YES")

    def test_time_limit_test(self):
        """ Quiz time limit test """

        import random

        # Time limit test
        imax = 100000
        numnums = ["ab" for i in range(imax)]
        test = "".join(numnums) + "\n"
        numnums = ["aa" for i in range(imax)]
        test += "".join(numnums) + "\n"

        import timeit

        start = timeit.default_timer()
        args = get_inputs(test)

        init = timeit.default_timer()
        d = Strings(args)

        calc = timeit.default_timer()
        d.calculate()

        stop = timeit.default_timer()
        print(
            "\nTime Test: " +
            "{0:.3f}s (inp {1:.3f}s init {2:.3f}s calc {3:.3f}s)".
            format(stop-start, init-start, calc-init, stop-calc))

if __name__ == "__main__":

    # Avoiding recursion limitaions
    sys.setrecursionlimit(100000)

    if sys.argv[-1] == "-ut":
        unittest.main(argv=[" "])

    # Print the result string
    sys.stdout.write(calculate())
