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

 public class B{
  static final int mod = 1000000009;

  static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

  static void parr(int []arr) throws Exception{
    for(int i : arr) System.out.print(i+" ");
    System.out.println();
  }
  static void parr(long []arr) throws Exception{
    for(long i : arr) System.out.print(i+" ");
    System.out.println();
  }
  static void parr(double []arr) throws Exception{
    for(double i : arr) System.out.print(i+" ");
    System.out.println();
  }
  static void parr(float []arr) throws Exception{
    for(float i : arr) System.out.print(i+" ");
    System.out.println();
  }

  static int inpi() throws Exception{
    return (int)(Integer.parseInt(br.readLine()));
  }
  static long inpl() throws Exception{
    return (long)Long.parseLong(br.readLine());
  }
  static double inpd() throws Exception{
    return (double)Double.parseDouble(br.readLine());
  }
  static float inpf() throws Exception{
    return (float)Float.parseFloat(br.readLine());
  }

  static int[] inpai() throws Exception{
    String ar[] = br.readLine().split(" ");
    int n = ar.length;
    int arr[] = new int[n];
    int k=0;
    for(String i : ar) arr[k++] = (int)(Integer.parseInt(i));
    return arr;
  }

  static double[] inpad() throws Exception{
    String ar[] = br.readLine().split(" ");
    int n = ar.length;
    double arr[] = new double[n];
    int k=0;
    for(String i : ar) arr[k++] = (double)(Double.parseDouble(i));
    return arr;
  }

  static float[] inpaf() throws Exception{
    String ar[] = br.readLine().split(" ");
          int n = ar.length;
    float arr[] = new float[n];
    int k=0;
    for(String i : ar) arr[k++] = (float)(Float.parseFloat(i));
    return arr;
  }

  static long[] inpal() throws Exception{
    String ar[] = br.readLine().split(" ");
          int n = ar.length;
    long arr[] = new long[n];
    int k=0;
    for(String i : ar) arr[k++] = (long)(Long.parseLong(i));
    return arr;
  }
///////
  static int arr[];
  static boolean dfs(int n,int i){
    if(n==0) return true;
    if(n<0 || i<0) return false;

    if(dfs(n-arr[i],i)) return true;
    if(dfs(n,i-1)) return true;
    return false;
  }

//////
  public static void main(String[] args)throws Exception{
    int t;
    t = inpi();
  //  t=1;
    arr = new int[]{11,111,1111,11111,111111,1111111,11111111,111111111};
    for(int z=1;z<=t;z++){
      int n = inpi();
      if(dfs(n,7)) System.out.println("YES");
      else System.out.println("NO");
    }
//////
  }
}
