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.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P559B {

  final static long HK = 29L;
  final static int CLEN = ('z' - 'a' + 1 + 1);

  long [] hk, ha, hb; // hash tables
  int [][] fa, fb;    // freq tables

  //-------------------------------------------------------------------

  void genHashTable() {
    for (int i = 0; i < hk.length; i++) {
      hk[i] = ((i == 0) ? 1 : hk[i - 1]) * HK;
    }
  }

  void genHashTable(int [] ch, long [] ht) {
    for (int i = 0; i < ch.length; i++) {
      ht[i] = ((i == 0) ? 0 : ht[i - 1]) * HK + ch[i];
    }
  }

  void genFreqTable(int [] ch, int [][] ft) {
    for (int i = 0; i < ch.length; i++) {
      ft[i] = (i == 0) ? new int [CLEN] : Arrays.copyOf(ft[i - 1], CLEN);
      ft[i][ch[i]]++;
      ft[i][0] ^= (1 << ch[i]);
    }
  }
                  
  //-------------------------------------------------------------------

  int [] getChars(String s) {
    int [] chars = new int [s.length()];
    for (int i = 0; i < chars.length; i++) {
      chars[i] = s.charAt(i) - 'a' + 1;
    }
    return chars;
  }

  long getHash(long [] ht, int i, int j) {
    return (ht[j - 1] - ((i == 0) ? 0L : ht[i - 1] * hk[j - i - 1]));
  }

  int [] getFreq(int [][] ft, int i, int j) {
    int [] freq = Arrays.copyOf(ft[j - 1], CLEN);
    i--;
    if (i >= 0) {
      freq[0] ^= ft[i][0];
      for (int k = 1; k < CLEN; k++) {
        freq[k] -= ft[i][k];
      }
    }
    return (freq);
  }

  boolean hashEquals(int ia, int ja, int ib, int jb) {
    return (getHash(ha, ia, ja) == getHash(hb, ib, jb));
  }

  boolean freqEquals(int ia, int ja, int ib, int jb) {
    return Arrays.equals(getFreq(fa, ia, ja), getFreq(fb, ib, jb));
  }

  boolean equals(int ia, int ja, int ib, int jb) {
    return (hashEquals(ia, ja, ib, jb) && freqEquals(ia, ja, ib, jb));
  }

  //-------------------------------------------------------------------

  boolean check(int ia, int ja, int ib, int jb) {
    if (equals(ia, ja, ib, jb) || (ia == ja)) {
      return true;
    } else if ((((ja - ia) & 0b1) == 1) || (!freqEquals(ia, ja, ib, jb))) {
      return false;
    }

    int ma = (ia + ja) >>> 1;
    int mb = (ib + jb) >>> 1;

    return ((check(ia, ma, ib, mb) && check(ma, ja, mb, jb)) ||
            (check(ia, ma, mb, jb) && check(ma, ja, ib, mb)));
    
  }

  //-------------------------------------------------------------------

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int [] a = getChars(next());
    int [] b = getChars(next());
    int len = a.length;

    hk = new long [len];
    ha = new long [len];
    hb = new long [len];
    fa = new int [len][CLEN];
    fb = new int [len][CLEN];

    genHashTable();
    genHashTable(a, ha);
    genHashTable(b, hb);
    genFreqTable(a, fa);
    genFreqTable(b, fb);
    a = b = null;
  
    println(check(0, len, 0, len) ? "YES" : "NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P559B().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}