You are given an integer x. Can you make x by summing up some number of 11, 111, 1111, 11111, …? (You can use any number among them any number of times).

For instance, 

  * 33=11+11+11 
  * 144=111+11+11+11 

Input

The first line of input contains a single integer t (1 ≤ t ≤ 10000) — the number of testcases.

The first and only line of each testcase contains a single integer x (1 ≤ x ≤ 10^9) — the number you have to make.

Output

For each testcase, you should output a single string. If you can make x, output "YES" (without quotes). Otherwise, output "NO".

You can print each letter of "YES" and "NO" in any case (upper or lower).

Example

Input


3
33
144
69


Output


YES
YES
NO

Note

Ways to make 33 and 144 were presented in the statement. It can be proved that we can't present 69 this way.
// created by 我不知道我是谁
import java.io.*;
import java.math.BigDecimal;
import java.util.*;
public class cp18{


    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }




    public static void main(String[] args)  throws IOException {
        Reader.init(System.in);
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
        int t= Reader.nextInt();
        for (int tt = 0; tt <t ; tt++) {
            long x= Reader.nextLong();
            long a= 11;
            long b=111;
            long mul=111*11+1;
            if(x>=mul){
                out.append("YES"+"\n");
            }
            else{
                boolean pos=false;
                for (long i = 0; i <20 ; i++) {
                    for (long j = 0; j <200 ; j++) {
                        if(111*i +11*j == x){
                            pos=true;
                            break;
                        }
                    }
                    if(pos){
                        break;
                    }
                }
                if(pos){
                    out.append("YES"+"\n");
                }
                else{
                    out.append("NO"+"\n");
                }




            }


        }








        out.flush();
        out.close();
    }
    static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    static long x=0;
    static long y=0;

    // Function to implement the extended
// euclid algorithm
    static long gcd_extend(long a, long b)
    {

        // Base Case
        if (b == 0)
        {
            x = 1;
            y = 0;
            return a;
        }

        // Recursively find the gcd
        else
        {
            long g = gcd_extend(b, a % b);
            long x1 = x, y1 = y;
            x = y1;
            y = x1 - (a / b) * y1;
            return g;
        }
    }

    // Function to print the solutions of
// the given equations ax + by = c
    static boolean print_solution(int a, int b, int c)
    {
        if (a == 0 && b == 0)
        {

            // Condition for infinite solutions
            if (c == 0)
            {
               return true;
            }

            // Condition for no solutions exist
            else
            {
                return false;
            }
        }
        long gcd = gcd_extend(a, b);

        // Condition for no solutions exist
        if (c % gcd != 0)
        {
            return false;
        }
        else
        {

            // Print the solution
           return true;
        }
    }


    static long power( long x, long y, long p)
    {

        long res = 1;


        x = x % p;

        if (x == 0) return 0;

        while (y > 0)
        {

            if((y & 1)==1)
                res = (res * x) % p;


            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }


}








