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.
//package codeforce.div2.r723;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.stream.Collectors;

import static java.lang.System.out;
import static java.util.stream.Collectors.joining;


/**
 * @author pribic (Priyank Doshi)
 * @see <a href="https://codeforces.com/contest/1526/problem/B" target="_top">https://codeforces.com/contest/1526/problem/B</a>
 * @since 28/05/21 8:15 PM
 */
public class B {
  static FastScanner sc = new FastScanner(System.in);

  public static void main(String[] args) {

    try (PrintWriter out = new PrintWriter(System.out)) {
      int[] dp = prebuildBfs();
      // Arrays.fill(dp, -1);
      int T = sc.nextInt();
      for (int tt = 1; tt <= T; tt++) {
        int n = sc.nextInt();
        //System.out.println(isValid(n, dp) == 1 ? "YES" : "NO");
        System.out.println(n >= dp.length || dp[n] == 1 ? "YES" : "NO");
      }
    }
  }

  private static boolean[] prebuild() {
    boolean[] dp = new boolean[1100];
    dp[0] = true;
    for (int i = 0; i < dp.length; i++) {
      if (dp[i]) {
        if (i + 11 < dp.length)
          dp[i + 11] = true;
        if (i + 111 < dp.length)
          dp[i + 111] = true;
      }
    }
    return dp;
  }

  private static int[] prebuildBfs() {
    int[] dp = new int[1100];
    Arrays.fill(dp, -1);
    ArrayDeque<Integer> queue = new ArrayDeque<>();
    queue.addLast(0);
    while (!queue.isEmpty()) {
      int n = queue.removeFirst();
      if (n < dp.length && dp[n] == -1) {
        //out.println(n);
        dp[n] = 1;
        queue.addLast(n + 11);
        queue.addLast(n + 111);
      }
    }
    return dp;//Arrays.stream(dp).mapToObj(num -> num == 1 ? new Boolean(true) : new Boolean(false)).toArray(Boolean[]::new);
  }

  private static int isValid(int n, int[] dp) {
    if (n < 0)
      return 0;
    if (n == 0 || n >= dp.length)
      return 1;
    if (dp[n] != -1)
      return dp[n];
    return dp[n] = (isValid(n - 11, dp) + isValid(n - 111, dp) > 0) ? 1 : 0;
  }

  static class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(File f) {
      try {
        br = new BufferedReader(new FileReader(f));
      } catch (FileNotFoundException e) {
        e.printStackTrace();
      }
    }

    public FastScanner(InputStream f) {
      br = new BufferedReader(new InputStreamReader(f), 32768);
    }

    String next() {
      while (st == null || !st.hasMoreTokens()) {
        String s = null;
        try {
          s = br.readLine();
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (s == null)
          return null;
        st = new StringTokenizer(s);
      }
      return st.nextToken();
    }

    boolean hasMoreTokens() {
      while (st == null || !st.hasMoreTokens()) {
        String s = null;
        try {
          s = br.readLine();
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (s == null)
          return false;
        st = new StringTokenizer(s);
      }
      return true;
    }

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

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

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