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.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        TaskB b = new TaskB();
        
        b.Solve();
    }
    
    static class TaskB {
        private String a,b;
        private int[] prefixesA31, prefixesB31;
        private int[] prefixesA53, prefixesB53;
        private Hasher hasher31, hasher53;
        
        public void Solve() {
            _input();
            
            hasher31 = new Hasher(31, 200001);
            hasher53 = new Hasher(53, 200001);
            
            int[] usedA = new int[26];
            int[] usedB = new int[26];
            
            for(int i = 0, n = a.length(); i < n; ++i) {
                usedA[a.codePointAt(i) - 'a']++;
                usedB[b.codePointAt(i) - 'a']++;
            }
            
            for(int i = 0; i < 26; ++i) {
                if(usedA[i] != usedB[i]) {
                    _output(false);
                    return;
                }
            }
            
            prefixesA31 = hasher31.HashPrefixes(a);
            prefixesB31 = hasher31.HashPrefixes(b);
            
            prefixesA53 = hasher53.HashPrefixes(a);
            prefixesB53 = hasher53.HashPrefixes(b);
            
            _output(_equiv(0, 0, a.length()));
        }
        
        private boolean _equiv(int posA, int posB, int length) {
            //System.out.println(length);
            if (hasher31.Compare(prefixesA31, prefixesB31, posA, posB, length) &&
                hasher53.Compare(prefixesA53, prefixesB53, posA, posB, length)) {
                return true;
            }
            
            if (length % 2 == 1)
                return false;
            
            return (_equiv(posA, posB, length / 2) && _equiv(posA + length / 2, posB + length / 2, length /2)) ||
                    (_equiv(posA, posB + length / 2, length / 2) && _equiv(posA + length / 2, posB, length /2));
        }
        
        private void _input() {
            /*File f = new File("input.txt");
            FileInputStream stream = null;
            try {
                stream = new FileInputStream(f);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }*/
            Reader reader = new Reader(System.in);//System.in);
            
            a = reader.next();
            b = reader.next();
        }
        
        private void _output(boolean answer) {
            Writer writer = new Writer(System.out);
            
            if(answer)
                writer.Writeln("YES");
            else
                writer.Writeln("NO");
            
            writer.close();
        }
        
        private class Hasher {
            private int[] _pows;
            private int _base;
            
            public Hasher(int base, int maxLength) {
                _base = base;
                _pows = new int[maxLength];
                
                _pows[0] = 1;
                for(int i = 1; i < maxLength; ++i)
                    _pows[i] = _pows[i-1] * base;
            }
            
            public int Hash (String x) {
                int hash = 0;
                for(int i = 0, len = x.length(); i < len; ++i) {
                    hash += (x.codePointAt(i) * _pows[i]);
                }
                
                return hash;
            }
            
            public int[] HashPrefixes(String x) {
                int length = x.length();
                int c = _base;
                
                int [] prefixes = new int[length];
                
                prefixes[0] = x.codePointAt(0);
                for(int i = 1; i < length; ++i)
                    prefixes[i] = prefixes[i-1] + (x.codePointAt(i) * _pows[i]);
                
                return prefixes;
            }
            
            public boolean Compare(int[] prefA, int[] prefB, int posA, int posB, int length) {
                int hashA = prefA[posA + length - 1] - (posA == 0 ? 0 : prefA[posA - 1]);
                int hashB = prefB[posB + length - 1] - (posB == 0 ? 0 : prefB[posB - 1]);
                
                if (posA < posB)
                    return hashA * _pows[posB - posA] == hashB;
                else
                    return hashA == hashB * _pows[posA - posB];
            }
        }
        
        public class Reader {
            public BufferedReader reader;
            public StringTokenizer tokenizer;

            public Reader(InputStream stream) {
                reader = new BufferedReader(new InputStreamReader(stream), 524288);
                tokenizer = null;
            }
            
            public Reader(FileInputStream stream) {
                reader = new BufferedReader(new InputStreamReader(stream), 524288);
                tokenizer = null;
            }

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

            public int nextInt() {
                return Integer.parseInt(next());
            }
            
            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        public class Writer {
            private PrintWriter writer;
            
            public Writer(OutputStream out) {
                writer = new PrintWriter(out);
            }
            
            public void Writeln(String value) {
                writer.println(value);
            }
            
            public void Write(String value) {
                writer.println(value);
            }
            
            public void Writeln(int value) {
                writer.println(value);
            }
            
            public void Write(int value) {
                writer.println(value);
            }
            
            public void Writeln(double value) {
                writer.println(value);
            }
            
            public void Write(double value) {
                writer.println(value);
            }
            
            public void Writeln(BigInteger value) {
                writer.println(value);
            }
            
            public void Write(BigInteger value) {
                writer.println(value);
            }
            
            public void close() {
                writer.close();
            }
        }   
    }
}