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.
    import java.io.*;
    import java.util.*;
    import java.lang.Math;


    public class Main {

          static PrintWriter pw;
          static Scanner sc;
          static StringBuilder ans;
          static long mod = 1000000000+7;

          static void pn(final Object arg) {
               pw.print(arg);          
               pw.flush();      
          }     

          /*-------------- for input in an value ---------------------*/
          static int ni()     { return sc.nextInt();       }
          static long nl()    { return sc.nextLong();      }
          static double nd()  { return sc.nextDouble();    }
          static String ns()  { return sc.next();          }


          static void ap(int arg)           { ans.append(arg); }
          static void ap(long arg)          { ans.append(arg); }
          static void ap(String arg)        { ans.append(arg); }
          static void ap(StringBuilder arg) { ans.append(arg); }        


          /*-------------- for input in an array ---------------------*/
          static void inputIntegerArray(int arr[]){
               for(int i=0; i<arr.length; i++)arr[i] = ni();
          }
          static void inputLongArray(long arr[]){
               for(int i=0; i<arr.length; i++)arr[i] = nl(); 
          }
          static void inputStringArray(String arr[]){
               for(int i=0; i<arr.length; i++)arr[i] = ns(); 
          }    
          static void inputDoubleArray(double arr[]){
               for(int i=0; i<arr.length; i++)arr[i] = nd();
          }


          /*-------------- File vs Input ---------------------*/
          static void runFile() throws Exception {
               sc = new Scanner(new FileReader("input.txt"));
               pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
          }
          static void runIo() throws Exception  {
               pw =new PrintWriter(System.out);
               sc = new Scanner(System.in);
          }    

          static void swap(int a, int b) {
               int  t = a;
               a = b;
               b = t;
          }

          static boolean isPowerOfTwo (long x) { return x!=0 && ((x&(x-1)) == 0);}

          static int gcd(int a, int b) { if (b == 0) return a;     return gcd(b, a % b); }
          
          static int countDigit(long n){return (int)Math.floor(Math.log10(n) + 1);} 
          
          static boolean isPrime(int n) { 
               if (n <= 1) return false; 
               if (n <= 3) return true; 
               if (n % 2 == 0 || n % 3 == 0) return false; 

               for (int i = 5; i * i <= n; i = i + 6) 
               if (n % i == 0 || n % (i + 2) == 0) 
                    return false; 

               return true; 
          }         

          static boolean sv[] = new boolean[10002];
           

          static void seive() {

                 //true -> not prime
               // false->prime

               sv[0] = sv[1] = true; 
               sv[2] = false;
               for(int i = 0; i< sv.length; i++) {
                    if( !sv[i] && (long)i*(long)i < sv.length ) {
                         for ( int j = i*i; j<sv.length ; j += i ) {                
                          sv[j] = true;
                         }
                    }
               }
 
          }


          static long kadensAlgo(int ar[]) {

               int n = ar.length;
    
               long pre = ar[0];
               long ans = ar[0];                

               for(int i = 1; i<n; i++) {

                    pre = Math.max(pre + ar[i], ar[i]);
                    ans = Math.max(pre, ans);

               }

               return ans;
          }


          static long  binpow( long a,   long b) {
               long res = 1;
               while (b > 0) {
                    if ( (b & 1) > 0){
                    res = (res * a)%mod;
               }
               a = (a * a)%mod;
               b >>= 1;
               }

               return res;
          }

          static long factorial(long n)  {
               long res = 1, i;
               for (i = 2; i <= n; i++){
                    res  =  ((res%mod) * (i%mod))%mod;
               }          
               return res;
          }
  

          static class Pair {
               int idx;
               int v;
               Pair(int idx, int v){
                    this.idx = idx;
                    this.v = v;
               }
          }
 
     
          public static void main(String[] args)  throws Exception {

               // runFile();  
  
               runIo();              

               int t;
               t = 1;     

               t =  sc.nextInt();
                
               ans = new StringBuilder();
          
               while( t-- > 0 ) {   
                    solve();
               }                
          
               pn(ans+""); 
 
          }
 
          public static void solve() {          
 
               int n = ni();

               int temp = 111;

               for(int d = 0; d <11; d++) {

                    temp = 111*d;

                    if( n >= temp && (n - temp) % 11 == 0 ) {
                         ap("YES\n");
                         return;
                    }


               }


               ap("NO\n");

         }  

 
     }
 

