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".
// All important imports 
import static java.lang.System.in;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.Queue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Vector;
public class Main{
    
    public static boolean areEqui(char[] a,  char[] b,int s1,int e1,int s2, int e2,int l){
        int i;
        boolean flag = true;
        int sum1=0, sum2=0;
        for(i=s1;i<=e1;i++){
            if(a[i]!=b[s2-s1+i])flag=false;
            sum1+=a[i]-97;
            sum2+=b[s2-s1+i]-97;
        }
        if(flag)return true;
        if(l%2==1)return false;
        if(sum1!= sum2)return false;
        boolean one = areEqui(a,b,s1,s1+l/2-1,s2,s2+l/2-1,l/2) && areEqui(a,b,s1+l/2,e1,s2+l/2,e2,l/2);
        if(one)return true;
        boolean two = areEqui(a,b,s1,s1+l/2-1,s2+l/2,e2,l/2) && areEqui(a,b,s1+l/2,e1,s2,s2+l/2-1,l/2);
        return two;
    }
    public static void solve(){
char a[] =ns().toCharArray();
char b[] =ns().toCharArray();
if(areEqui(a,b,0,a.length-1,0,a.length-1,a.length))
    out.println("YES");
else 
    out.println("NO");
    }
        
        
    
        // END OF SOLUTION
        // INPUT OUTPUT TEMPLATE
        static String TESTCASES;
        static PrintWriter out;
    public static void main(String[] args) throws Exception,IOException{
                out=new PrintWriter(System.out);
                InputStream myinp=System.in;
                init(myinp);
//                int t=ni();
//                while(t-->0)
                {solve();}
                out.close();
                
                  }
        
    
        static InputStream is;
        static BufferedReader brr;
        static int BUFFER_SIZE = 65000;
        static DataInputStream din;
        static byte[] buffer;
        static int bufferPointer, bytesRead;
        public static void init(InputStream input) {
        is=input;
        brr=new BufferedReader(new InputStreamReader(input));
        din = new DataInputStream(in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
        }
        
    
    protected static byte[] inbuf = new byte[1024];
    static int lenbuf = 0, ptrbuf = 0;
    
        static byte read() throws Exception
        {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }
        
    protected static int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }
        
        protected static String readline() throws IOException
        {
            return brr.readLine();
        }
                
    
    
    // extras
    protected static double nd() { return Double.parseDouble(ns()); }
    protected static char nc() { return (char)skip(); }
    protected static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    protected static int skip() { 
            int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; 
        }
        static void fillBuffer() throws Exception
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }
        
    protected static String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    protected static char[] nca(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }
    
    
    protected static int[] nia(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }
        
        protected static int[][] niaindex(int n)
        {
                int ea[][]=new int[n][2];
                for(int i=0;i<n;i++)
                {
                    ea[i][0]=ni();
                    ea[i][1]=i;
                }
                return ea;
        }
        
        protected static long[] nla(int n)
    {
        long[] a = new long[n];
        for(int i = 0;i < n;i++)a[i] = nl();
        return a;
    }
        
        protected static long[][] nlaindex(int n)
        {
                long ea[][]=new long[n][2];
                for(int i=0;i<n;i++)
                {
                    ea[i][0]=ni();
                    ea[i][1]=i;
                }
                return ea;
        }
        
        protected static String[] nsa(int n)
    {
        String[] a = new String[n];
        for(int i = 0;i < n;i++)a[i] = ns();
        return a;
    }
        
        protected static double[] nda(int n)
    {
        double[] a = new double[n];
        for(int i = 0;i < n;i++)a[i] = nd();
        return a;
    }
    
        static int ni2() throws Exception
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = c == '-';
            if (neg) c = read();
            do
            {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
            if (neg) return -ret;
            return ret;
 
        }
        
        
 
    
        
    protected static int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
        
    
    protected static long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        
        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
        
        
        // Outputs
        public static void pln(){out.println();}
        public static void ps(String s){out.print(s);}
        public static void pi(int s){out.print(s);}
        public static void pl(long s){out.print(s);}
        public static void pd(double s){out.print(s);}
        public static void psp(){out.print(" ");}
        public static void parr(int s[]){out.println(Arrays.toString(s));}
        public static void parr(String s[]){out.println(Arrays.toString(s));}
        public static void parr(long s[]){out.println(Arrays.toString(s));}        
        public static void parr2(int s[][]){for(int i=0;i<s.length;i++)out.println(Arrays.toString(s[i]));}
        public static void parr2(long s[][]){for(int i=0;i<s.length;i++)out.println(Arrays.toString(s[i]));}
        public static void parr2(String s[][]){for(int i=0;i<s.length;i++)out.println(Arrays.toString(s[i]));}
 
}
    
