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".

import java.io.*;
import java.util.*;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;

public class EquivalentStrings {
    static class Task {

        String x, y;
        TreeMap<Pair<String, String>, Boolean> memo = new TreeMap<>();

        boolean equiv(String a, String b) {
            if (a.length() % 2 == 1) {
                return a.equals(b);
            }

            Pair<String, String> key = new Pair<>(a, b);
            if (memo.containsKey(key)) {
                return memo.get(key);
            }

            String a1 = a.substring(0, a.length() / 2);
            String a2 = a.substring(a.length() / 2);
            String b1 = b.substring(0, b.length() / 2);
            String b2 = b.substring(b.length() / 2);

            boolean ret = (equiv(a1, b1) && equiv(a2, b2)) || (equiv(a1, b2) && equiv(a2, b1));
            memo.put(key, ret);
            return ret;
        }

        public void solve(InputReader in, PrintWriter out) {
            x = in.next();
            y = in.next();

            if (equiv(x, y)) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }

        /**
         * Pair Class
         */
        class Pair<F extends Comparable<F>, S extends Comparable<S>> implements Comparable<Pair<F, S>> {
            F first; // first member of pair
            S second; // second member of pair

            Pair(F first, S second) {
                this.first = first;
                this.second = second;
            }

            @Override
            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;

                Pair<?, ?> pair = (Pair<?, ?>) o;

                if (!first.equals(pair.first)) return false;
                return second.equals(pair.second);
            }

            @Override
            public int hashCode() {
                int result = first.hashCode();
                result = 31 * result + second.hashCode();
                return result;
            }

            @Override
            public int compareTo(Pair<F, S> o) {
                int fRes = first.compareTo(o.first);
                return (fRes == 0) ? second.compareTo(o.second) : fRes;
            }
        }
    }


    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        int t = 1;
        // t = in.nextInt();
        for (int i = 1; i <= t; i++) {
            solver.solve(in, out);
        }
        out.close();
    }


    /**
     * gcd/lcm
     */
    static int gcd(int a, int b) {
        if (a == 0) {
            return b;
        } else {
            return gcd(b % a, a);
        }
    }

    static long gcd(long a, long b) {
        if (a == 0) {
            return b;
        } else {
            return gcd(b % a, a);
        }
    }

    static long lcm(int a, int b) {
        return (long) a / gcd(a, b) * b;
    }

    static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    /*
     * Modular arithmetic
     */
    static int modPow(int base, int exponent, int mod) {
        if (exponent == 0) {
            return 1 % mod;
        }
        long ret = modPow(base, exponent / 2, mod);
        ret = (ret * ret) % mod;
        if (exponent % 2 == 1) {
            ret = (ret * base) % mod;
        }
        return (int) ret;
    }

    static int inv(int number, int prime) {
        return modPow(number, prime - 2, prime);
    }

    static final int MOD = (int) 1e9 + 7;

    static int add(int a, int b) {
        return (a + b) % MOD;
    }

    static int sub(int a, int b) {
        int ret = (a - b) % MOD;
        return (ret < 0) ? ret + MOD : ret;
    }

    static int mul(int a, int b) {
        return (int) (((long) a * b) % MOD);
    }

    static int divide(int a, int b) {
        return mul(a, inv(b, MOD));
    }


    /**
     * IO
     */
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) {
            int[] ret = new int[n];
            Arrays.setAll(ret, i -> nextInt());
            return ret;
        }

        public double[] nextDoubleArray(int n) {
            double[] ret = new double[n];
            Arrays.setAll(ret, i -> nextDouble());
            return ret;
        }

        public long[] nextLongArray(int n) {
            long[] ret = new long[n];
            Arrays.setAll(ret, i -> nextLong());
            return ret;
        }
    }
}
