package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			// fmt.Println("YES")
			ws.WriteString("YES" + "\n")
		} else {
			var elv int
			var flag bool = false
			for elv = 0; elv < int(n/111)+2; elv++ {

				if (n-111*elv)%11 == 0 && (n-111*elv) >= 0 {
					// fmt.Println("YES")
					ws.WriteString("YES" + "\n")
					flag = true
					break
				}
			}

			if !flag {
				// fmt.Println("NO")
				ws.WriteString("NO" + "\n")
			}
		}

	}
	ws.Flush()

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			// fmt.Println("YES")
			ws.WriteString("YES" + "\n")
		} else {
			var elv, elev int
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						// fmt.Println("YES")
						ws.WriteString("YES" + "\n")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				// fmt.Println("NO")
				ws.WriteString("NO" + "\n")
			}
		}

	}
	ws.Flush()

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			fmt.Println("YES")
		} else {
			var elv, elev int
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						fmt.Println("YES")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				fmt.Println("NO")
			}
		}
	}

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"fmt"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

func main() {

	var t, i, n int
	fmt.Scan(&t)
	for i = 0; i < t; i++ {
		fmt.Scan(&n)
		if n > 1099 {
			fmt.Println("YES")
		} else {
			var elv, elev int
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						fmt.Println("YES")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				fmt.Println("NO")
			}
		}
	}

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"fmt"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

func main() {

	var t, i, n int32
	fmt.Scan(&t)
	for i = 0; i < t; i++ {
		fmt.Scan(&n)
		if n > 1099 {
			fmt.Println("YES")
		} else {
			var elv, elev int32
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						fmt.Println("YES")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				fmt.Println("NO")
			}
		}
	}

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"fmt"
	// helpers "practiceg/helper" //path of package and then used with package name
	"strings"
	"sync"
	"time"
)

func main() {

	var t, i int32
	fmt.Scan(&t)
	for i = 0; i < t; i++ {
		var n int32
		fmt.Scan(&n)
		if n > 1099 {
			fmt.Println("YES")
		} else {
			var elv, elev int32
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						fmt.Println("YES")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				fmt.Println("NO")
			}
		}
	}

}

//---------------------------========================-----------------
var wg = sync.WaitGroup{}

func prac() {

	// variables
	// helpers.Main()
	var name = "mani"
	lastName := "uniyal"
	const age = 10
	fmt.Print(name, lastName, age)
	fmt.Printf("hello %v ads", name)
	fmt.Printf("hello %T ads", name)
	fmt.Println(" hello world")

	var n float64
	n = 10.5
	fmt.Print((n))

	//input
	// giving arg to func as pointer of variable
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Print(a, b, c)

	// arrays  and slices
	// arrays have fixed size  var booking = [50]int{} --> empty array
	//var booking = [50]int{1, 2, 3} --> 3 ele are given
	var booking = [50]int{1, 2}
	fmt.Printf("%T", booking)
	// assig
	booking[1] = 100

	fmt.Print(booking, len(booking))

	// slices --> dynamic arrayvar slice =  []int{}
	var slice []int
	slice = append(slice, 1)
	slice = append(slice, 2)
	slice = append(slice, 3)
	fmt.Print(slice, len(slice))

	// infinite for loop
	// for {
	// 	fmt.Print("Hello")
	// }

	//for each loop
	var firstName = []string{}
	firstName = append(firstName, "ashu uniyal")
	firstName = append(firstName, "nitin uniyal")
	for index, book := range firstName {
		var na = strings.Fields(book) // returns list
		fmt.Println(na[0], index)
	}
	// we can use _ for variable which are not used
	for _, book := range firstName {
		var na = strings.Fields(book) // returns list
		fmt.Println(na[0])
	}

	// if else statement continue
	for _, book := range firstName {
		var na = strings.Fields(book) // returns list
		if na[0] == "ashu" {
			fmt.Println("inside if ")
		} else if na[0] == "nitin" {
			fmt.Println("inside elif ")
		} else {
			fmt.Println(na[0])
			break
		}
	}

	// for loop with condition && --> and condtion  || or
	x := 1
	for x < 10 {
		fmt.Println(x)
		x += 1
	}

	// switch
	city := "London"

	switch city {
	case "London":
		fmt.Println(city, "L")

	case "Delhi", "Berlin":
		//or statement
		fmt.Println(city, "N")

	case "New York":
		fmt.Println(city, "N")
	default:
		//none of above are true
		fmt.Println(city, "None")
	}
	// slice are refrance type and arr are pass by value
	// parameters pass as func func_name(para_name *int[](passing pointer))
	// &a means memory address *a --> gives value at memmory address a
	// func xyz(a *int) -- > a has value type *int
	var m, w = 1, 3
	fmt.Println(add(m, w), "main func")
	fmt.Println(m)
	modify(firstName)
	fmt.Println(firstName, "inside main")

	modifyarr(&booking)
	fmt.Println(booking, "inside main")

	var temp [2][2]int // 2d array
	fmt.Println(temp)

	//first  [] --> outer brakets of 2d arr
	var tem [2][]int
	var z []int
	z = append(z, 111)
	// tem[0] = z

	fmt.Println(tem, z, "temp")

	var te [][]int
	var y []int
	y = append(y, 111)
	te = append(te, y)

	fmt.Println(te, y)

	// go function can return multiple values retunr type  ( int, string )
	var j, k, l = multipleValue("ashu", 10, 9)
	fmt.Println(j, k, l)

	//package level variable
	//defined out side of all function and accessible from all function
	// package level variable can not be created as a := 10 by this syntex
	// var a = 10 --> pakage level variable

	//--------------------------------
	//multiple files in go
	// q := helpers.Sq(25)
	// fmt.Println(q, "kdfkjkdfj")

	// go rum directory_name --> run all file with in directory
	// go run .

	//maps ===> var name = map[key_type]value  type of map map[string]string
	//make --> creating empty map
	// we can not mix data type in map
	//strconv.FormatUint(uint64(userTic), 10)

	// slice of maps --> var bokking = make([]map[string]string, 0)
	var details = make(map[string]string)
	details["firstName"] = "ashu"
	fmt.Println(details)

	///struct datatype values of mixed datatype
	/// list of struct --> var booking = make([]userInfo, 0)
	// geting values from struc --> name_struct.field_name
	type userInfo struct {
		firstName string
		age       int
	}
	var info = userInfo{
		firstName: "ashu",
		age:       10,
	}

	fmt.Println((info))

	///fmt.sprintf(formated_string ) return --> resulting string

	//time.Sleep(10*time.Second)
	//creating sseprate thread
	// go function_name(1, 2)--> run this function on seprate thread
	// main thread does not wait for other thread to complete task
	wg.Add(1) // add thread number of thread man thread wait to complete
	go sendTicket(20)

	fmt.Println("completed")

	wg.Wait() // wait for other added therad to complete

	//go uses green thread -- > abstraction of actual thread

}

// func name_func(delclare parameters ) return type
func add(a int, b int) int {
	fmt.Println("inside add func", a)

	return a + b
}

func modify(firstNam []string) {
	firstNam[0] = "mmmmmmm"
	fmt.Println(firstNam, "inside modify")
}

func modifyarr(firstNam *[50]int) {
	firstNam[0] = 1111
	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
}

func multipleValue(str string, a int, b int) (string, int, int) {

	return str, a + b, a - b
}

func Mul(a int, b int) int {
	return a * b
}

func sendTicket(no int) {
	time.Sleep(10 * time.Second)
	fmt.Println("sending ===========", no)
	wg.Done() //removes the thread from waith froup
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

/*
4
99
110
121
122
---
YES
YES
YES
YES
======
2
98
109
---
NO
NO

*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int64
	scanf("%d\n", &n)

	for d := int64(0); d < 11; d++ {
		a := n - d*111
		if a >= 0 && a%11 == 0 {
			fmt.Fprintln(writer, "YES")
			return
		}
	}

	fmt.Fprintln(writer, "NO")
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

const M = 1e9 + 7;
const MAXN = 2e3 + 5;

var bytes []byte;

func nextByte() byte {
	b := bytes[0];
	bytes = bytes[1:];
	return b;
}

func ScanInt64() int64 {
	var negative bool;
	var result int64;
	b := nextByte();
	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true;
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0');
	}

	if negative {
		return -result;
	} else {
		return result;
	}
}

func ScanInt() int {
	return int(ScanInt64());
}

func ScanString() string {
	builder := strings.Builder{};

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b);
		}
	}
	return builder.String();
}

func init() {
	if (len(os.Args) > 1 && os.Args[1] == "LOCAL_JUDGE") {
		stdin, _ := os.OpenFile("input.txt", os.O_RDONLY | os.O_CREATE, 0666);
		stdout, _ := os.OpenFile("output.txt", os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0666);
		os.Stdin = stdin;
		os.Stdout = stdout;
	}
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin));
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		x := ScanInt();
		flag := true;
		for i := 0; i < 11; i++ {
			if x < (i * 111) {
				break;
			}
			if (x - (i * 111)) % 11 == 0 {
				fmt.Printf("YES\n");
				flag = false;
			}
		}
		if (flag) {
			fmt.Printf("NO\n");
		}
	}
	return;
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func calc(x int) bool {
	for i:= 0; i*111 <= x; i++ {
		if (x- i*111) % 11 == 0 {
			return true
		}
	}
	return false
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(pk)
	//known := make(map [int] bool)

	inputList := make([] int, k)
	mxIn := 0
	for oi := 0; oi < k; oi++ {

		culprit, _ := Readln(reader)
		in, _ := strconv.Atoi(culprit)
		if in > mxIn {
			mxIn = in
		}
		inputList[oi] = in
	}
	//1111 = 11*101
	//11111 = 111*100 + 11
	//therefore we only need to count from 11 and 111
	// n= a*111 + b *11 = (10a+b)*11 + a

	for _, in := range inputList {
		if calc(in){
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	scn  = bufio.NewReader(os.Stdin)
	prnt = bufio.NewWriter(os.Stdout)
)

func main() {
    defer prnt.Flush()
	var t int
	fmt.Fscan(scn, &t)
	for i := 0; i < t; i++ {
		var n int64
		fmt.Fscan(scn, &n)
		k := 110
		m := n % 11
		if int64(m)*int64(k) <= n {
			fmt.Fprintln(prnt, "YES")
		} else {
			fmt.Fprintln(prnt, "NO")
		}
	}

}

func min(a ...int) int {
	mn := a[0]
	length := len(a)
	for i := 0; i < length; i++ {
		if a[i] < mn {
			mn = a[i]
		}
	}
	return mn
}

func max(a ...int) int {
	mx := a[0]
	length := len(a)
	for i := 0; i < length; i++ {
		if a[i] > mx {
			mx = a[i]
		}
	}
	return mx
}

func queue(queue []int, element int) []int {
	queue = append(queue, element)
	return queue
}

func dequeue(queue []int) []int {
	return queue[1:]
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Fscan(in, &n)

		if n >= 1100 {
			fmt.Fprintln(out, "YES")
		} else {
			var f bool
			for i := 0; i*111 <= n; i++ {
				if (n-i*111)%11 == 0 {
					f = true
					break
				}
			}

			if f {
				fmt.Fprintln(out, "YES")
			} else {
				fmt.Fprintln(out, "NO")
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	var l, q int64
	l = MAX(x, y)
	q = MIN(x, y)
	var m int64
	for l*q > 0 {
		a := l % q
		b := l - a
		cc := int64(b / q)
		remain := l - cc*q
		l = MAX(remain, q)
		q = MIN(remain, q)
		if l*q == 0 {
			m = l + q
			break
		}

	}
	return m
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func LITTLE(x int) int64 {
	var answer int64
	answer = answer + int64((x*x*x*x-x*x)/4) + int64(x*x*(x-1)*(x-1)/8) - int64(x*(x-1)*(x+x+1)*(x+x-1)/12)
	return answer
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for i := 0; i < t; i++ {

		var n int
		fmt.Fscan(input, &n)

		if n%11 == 0 {
			fmt.Println("YES")
		} else {
			m := n % 11
			if n >= m*111 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}

	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	a := []int64{11}
	for i := 0; i<11; i++ {
		a = append(a, a[len(a)-1]*10+1)
	}

	dp := make([]int, 1e6)
	for i := range dp {
		dp[i] = -1
	}
	var f func(int) int
	f = func(p int) (res int) {
		if p == 0 {
			return 1
		}
		dv := &dp[p]
		if *dv != -1 {
			return *dv
		}
		defer func() { *dv = res }()
		for _, v := range a {
			if v<=int64(p) {
				if f(p-int(v))>0 {
					return 1
				}
			}
		}

		return 0
	}

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		if n > 3e5 || f(n) > 0 {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}

	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

func main() { run(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()

		var elv int
		var flag bool = false
		for elv = 0; elv < int(n/111)+2; elv++ {

			if (n-111*elv)%11 == 0 && (n-111*elv) >= 0 {
				// fmt.Println("YES")
				ws.WriteString("YES" + "\n")
				flag = true
				break
			}

		}
		if !flag {
			// fmt.Println("NO")
			ws.WriteString("NO" + "\n")
		}
	}

	ws.Flush()

}

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()

		var elv int
		var flag bool = false
		for elv = 0; elv < int(n/11)+2; elv++ {

			if (n-11*elv)%111 == 0 {
				// fmt.Println("YES")
				ws.WriteString("YES" + "\n")
				flag = true
				break
			}

		}
		if !flag {
			// fmt.Println("NO")
			ws.WriteString("NO" + "\n")
		}
	}

	ws.Flush()

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			// fmt.Println("YES")
			ws.WriteString("YES" + "\n")
		} else {
			var elv int
			var flag bool = false
			for elv = 0; elv < int(n/111)+2; elv++ {

				if (n-111*elv)%11 == 0 {
					// fmt.Println("YES")
					ws.WriteString("YES" + "\n")
					flag = true
					break
				}
			}

			if !flag {
				// fmt.Println("NO")
				ws.WriteString("NO" + "\n")
			}
		}

	}
	ws.Flush()

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			// fmt.Println("YES")
			ws.WriteString("YES" + "\n")
		} else {
			var elv int
			var flag bool = false
			for elv = 0; elv < 100; elv++ {

				if (n-11*elv)%111 == 0 {
					// fmt.Println("YES")
					ws.WriteString("YES" + "\n")
					flag = true
					break
				}
			}

			if !flag {
				// fmt.Println("NO")
				ws.WriteString("NO" + "\n")
			}
		}

	}
	ws.Flush()

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	max = len(bytes) - 1
	var i, n int
	ws := bufio.NewWriter(os.Stdout)
	t := fastScan()
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			// fmt.Println("YES")
			ws.WriteString("YES" + "\n")
		} else {
			var elv, elev int
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						// fmt.Println("YES")
						ws.WriteString("YES" + "\n")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				// fmt.Println("NO")
				ws.WriteString("NO" + "\n")
			}
		}
	}

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	// helpers "practiceg/helper" //path of package and then used with package name
	// "strings"
	// "sync"
	// "time"
)

var bytes []byte
var l, max int

func fastScan() int {
	b := bytes[l]

	// Check if the bytes is not a number
	for b < 48 || b > 57 {
		l++
		b = bytes[l]
	}

	result := 0
	for 47 < b && b < 58 {
		result = (result << 3) + (result << 1) + int(b-48)

		l++
		if l > max {
			return result
		}
		b = bytes[l]
	}
	return result
}

func main() {
	// fmt.Println("hello")
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin))
	fmt.Println("hello")
	max = len(bytes) - 1
	var i, n int
	t := fastScan()
	fmt.Println(t)
	for i = 0; i < t; i++ {
		n = fastScan()
		if n > 1099 {
			fmt.Println("YES")
		} else {
			var elv, elev int
			var flag bool = false
			for elv = 0; elv < 100; elv++ {
				for elev = 0; elev < 11; elev++ {

					if (11*elv + 111*elev) == n {
						fmt.Println("YES")
						flag = true
						break
					}
				}
				if flag {
					break
				}
			}
			if !flag {
				fmt.Println("NO")
			}
		}
	}

}

//---------------------------========================-----------------
// var wg = sync.WaitGroup{}

// func prac() {

// 	// variables
// 	// helpers.Main()
// 	var name = "mani"
// 	lastName := "uniyal"
// 	const age = 10
// 	fmt.Print(name, lastName, age)
// 	fmt.Printf("hello %v ads", name)
// 	fmt.Printf("hello %T ads", name)
// 	fmt.Println(" hello world")

// 	var n float64
// 	n = 10.5
// 	fmt.Print((n))

// 	//input
// 	// giving arg to func as pointer of variable
// 	var a, b, c int
// 	fmt.Scan(&a)
// 	fmt.Scan(&b)
// 	fmt.Scan(&c)
// 	fmt.Print(a, b, c)

// 	// arrays  and slices
// 	// arrays have fixed size  var booking = [50]int{} --> empty array
// 	//var booking = [50]int{1, 2, 3} --> 3 ele are given
// 	var booking = [50]int{1, 2}
// 	fmt.Printf("%T", booking)
// 	// assig
// 	booking[1] = 100

// 	fmt.Print(booking, len(booking))

// 	// slices --> dynamic arrayvar slice =  []int{}
// 	var slice []int
// 	slice = append(slice, 1)
// 	slice = append(slice, 2)
// 	slice = append(slice, 3)
// 	fmt.Print(slice, len(slice))

// 	// infinite for loop
// 	// for {
// 	// 	fmt.Print("Hello")
// 	// }

// 	//for each loop
// 	var firstName = []string{}
// 	firstName = append(firstName, "ashu uniyal")
// 	firstName = append(firstName, "nitin uniyal")
// 	for index, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0], index)
// 	}
// 	// we can use _ for variable which are not used
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		fmt.Println(na[0])
// 	}

// 	// if else statement continue
// 	for _, book := range firstName {
// 		var na = strings.Fields(book) // returns list
// 		if na[0] == "ashu" {
// 			fmt.Println("inside if ")
// 		} else if na[0] == "nitin" {
// 			fmt.Println("inside elif ")
// 		} else {
// 			fmt.Println(na[0])
// 			break
// 		}
// 	}

// 	// for loop with condition && --> and condtion  || or
// 	x := 1
// 	for x < 10 {
// 		fmt.Println(x)
// 		x += 1
// 	}

// 	// switch
// 	city := "London"

// 	switch city {
// 	case "London":
// 		fmt.Println(city, "L")

// 	case "Delhi", "Berlin":
// 		//or statement
// 		fmt.Println(city, "N")

// 	case "New York":
// 		fmt.Println(city, "N")
// 	default:
// 		//none of above are true
// 		fmt.Println(city, "None")
// 	}
// 	// slice are refrance type and arr are pass by value
// 	// parameters pass as func func_name(para_name *int[](passing pointer))
// 	// &a means memory address *a --> gives value at memmory address a
// 	// func xyz(a *int) -- > a has value type *int
// 	var m, w = 1, 3
// 	fmt.Println(add(m, w), "main func")
// 	fmt.Println(m)
// 	modify(firstName)
// 	fmt.Println(firstName, "inside main")

// 	modifyarr(&booking)
// 	fmt.Println(booking, "inside main")

// 	var temp [2][2]int // 2d array
// 	fmt.Println(temp)

// 	//first  [] --> outer brakets of 2d arr
// 	var tem [2][]int
// 	var z []int
// 	z = append(z, 111)
// 	// tem[0] = z

// 	fmt.Println(tem, z, "temp")

// 	var te [][]int
// 	var y []int
// 	y = append(y, 111)
// 	te = append(te, y)

// 	fmt.Println(te, y)

// 	// go function can return multiple values retunr type  ( int, string )
// 	var j, k, l = multipleValue("ashu", 10, 9)
// 	fmt.Println(j, k, l)

// 	//package level variable
// 	//defined out side of all function and accessible from all function
// 	// package level variable can not be created as a := 10 by this syntex
// 	// var a = 10 --> pakage level variable

// 	//--------------------------------
// 	//multiple files in go
// 	// q := helpers.Sq(25)
// 	// fmt.Println(q, "kdfkjkdfj")

// 	// go rum directory_name --> run all file with in directory
// 	// go run .

// 	//maps ===> var name = map[key_type]value  type of map map[string]string
// 	//make --> creating empty map
// 	// we can not mix data type in map
// 	//strconv.FormatUint(uint64(userTic), 10)

// 	// slice of maps --> var bokking = make([]map[string]string, 0)
// 	var details = make(map[string]string)
// 	details["firstName"] = "ashu"
// 	fmt.Println(details)

// 	///struct datatype values of mixed datatype
// 	/// list of struct --> var booking = make([]userInfo, 0)
// 	// geting values from struc --> name_struct.field_name
// 	type userInfo struct {
// 		firstName string
// 		age       int
// 	}
// 	var info = userInfo{
// 		firstName: "ashu",
// 		age:       10,
// 	}

// 	fmt.Println((info))

// 	///fmt.sprintf(formated_string ) return --> resulting string

// 	//time.Sleep(10*time.Second)
// 	//creating sseprate thread
// 	// go function_name(1, 2)--> run this function on seprate thread
// 	// main thread does not wait for other thread to complete task
// 	wg.Add(1) // add thread number of thread man thread wait to complete
// 	go sendTicket(20)

// 	fmt.Println("completed")

// 	wg.Wait() // wait for other added therad to complete

// 	//go uses green thread -- > abstraction of actual thread

// }

// // func name_func(delclare parameters ) return type
// func add(a int, b int) int {
// 	fmt.Println("inside add func", a)

// 	return a + b
// }

// func modify(firstNam []string) {
// 	firstNam[0] = "mmmmmmm"
// 	fmt.Println(firstNam, "inside modify")
// }

// func modifyarr(firstNam *[50]int) {
// 	firstNam[0] = 1111
// 	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
// }

// func multipleValue(str string, a int, b int) (string, int, int) {

// 	return str, a + b, a - b
// }

// func Mul(a int, b int) int {
// 	return a * b
// }

// func sendTicket(no int) {
// 	time.Sleep(10 * time.Second)
// 	fmt.Println("sending ===========", no)
// 	wg.Done() //removes the thread from waith froup
// }

package main

import (
	"fmt"
	// helpers "practiceg/helper" //path of package and then used with package name
	"strings"
	"sync"
	"time"
)

func main() {

	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		if n > 1099 {
			fmt.Println("NO")
		} else {
			flag := false
			for elv := 0; elv < 100; elv++ {
				for elev := 0; elev < 11; elev++ {
					if 11*elv+111*elev == n {
						fmt.Println("YES")
						flag = true
						break
					}
					if flag {
						break
					}
				}
			}
			if !flag {
				fmt.Println("NO")
			}
		}
	}

}

//---------------------------========================-----------------
var wg = sync.WaitGroup{}

func prac() {

	// variables
	// helpers.Main()
	var name = "mani"
	lastName := "uniyal"
	const age = 10
	fmt.Print(name, lastName, age)
	fmt.Printf("hello %v ads", name)
	fmt.Printf("hello %T ads", name)
	fmt.Println(" hello world")

	var n float64
	n = 10.5
	fmt.Print((n))

	//input
	// giving arg to func as pointer of variable
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Print(a, b, c)

	// arrays  and slices
	// arrays have fixed size  var booking = [50]int{} --> empty array
	//var booking = [50]int{1, 2, 3} --> 3 ele are given
	var booking = [50]int{1, 2}
	fmt.Printf("%T", booking)
	// assig
	booking[1] = 100

	fmt.Print(booking, len(booking))

	// slices --> dynamic arrayvar slice =  []int{}
	var slice []int
	slice = append(slice, 1)
	slice = append(slice, 2)
	slice = append(slice, 3)
	fmt.Print(slice, len(slice))

	// infinite for loop
	// for {
	// 	fmt.Print("Hello")
	// }

	//for each loop
	var firstName = []string{}
	firstName = append(firstName, "ashu uniyal")
	firstName = append(firstName, "nitin uniyal")
	for index, book := range firstName {
		var na = strings.Fields(book) // returns list
		fmt.Println(na[0], index)
	}
	// we can use _ for variable which are not used
	for _, book := range firstName {
		var na = strings.Fields(book) // returns list
		fmt.Println(na[0])
	}

	// if else statement continue
	for _, book := range firstName {
		var na = strings.Fields(book) // returns list
		if na[0] == "ashu" {
			fmt.Println("inside if ")
		} else if na[0] == "nitin" {
			fmt.Println("inside elif ")
		} else {
			fmt.Println(na[0])
			break
		}
	}

	// for loop with condition && --> and condtion  || or
	x := 1
	for x < 10 {
		fmt.Println(x)
		x += 1
	}

	// switch
	city := "London"

	switch city {
	case "London":
		fmt.Println(city, "L")

	case "Delhi", "Berlin":
		//or statement
		fmt.Println(city, "N")

	case "New York":
		fmt.Println(city, "N")
	default:
		//none of above are true
		fmt.Println(city, "None")
	}
	// slice are refrance type and arr are pass by value
	// parameters pass as func func_name(para_name *int[](passing pointer))
	// &a means memory address *a --> gives value at memmory address a
	// func xyz(a *int) -- > a has value type *int
	var m, w = 1, 3
	fmt.Println(add(m, w), "main func")
	fmt.Println(m)
	modify(firstName)
	fmt.Println(firstName, "inside main")

	modifyarr(&booking)
	fmt.Println(booking, "inside main")

	var temp [2][2]int // 2d array
	fmt.Println(temp)

	//first  [] --> outer brakets of 2d arr
	var tem [2][]int
	var z []int
	z = append(z, 111)
	// tem[0] = z

	fmt.Println(tem, z, "temp")

	var te [][]int
	var y []int
	y = append(y, 111)
	te = append(te, y)

	fmt.Println(te, y)

	// go function can return multiple values retunr type  ( int, string )
	var j, k, l = multipleValue("ashu", 10, 9)
	fmt.Println(j, k, l)

	//package level variable
	//defined out side of all function and accessible from all function
	// package level variable can not be created as a := 10 by this syntex
	// var a = 10 --> pakage level variable

	//--------------------------------
	//multiple files in go
	// q := helpers.Sq(25)
	// fmt.Println(q, "kdfkjkdfj")

	// go rum directory_name --> run all file with in directory
	// go run .

	//maps ===> var name = map[key_type]value  type of map map[string]string
	//make --> creating empty map
	// we can not mix data type in map
	//strconv.FormatUint(uint64(userTic), 10)

	// slice of maps --> var bokking = make([]map[string]string, 0)
	var details = make(map[string]string)
	details["firstName"] = "ashu"
	fmt.Println(details)

	///struct datatype values of mixed datatype
	/// list of struct --> var booking = make([]userInfo, 0)
	// geting values from struc --> name_struct.field_name
	type userInfo struct {
		firstName string
		age       int
	}
	var info = userInfo{
		firstName: "ashu",
		age:       10,
	}

	fmt.Println((info))

	///fmt.sprintf(formated_string ) return --> resulting string

	//time.Sleep(10*time.Second)
	//creating sseprate thread
	// go function_name(1, 2)--> run this function on seprate thread
	// main thread does not wait for other thread to complete task
	wg.Add(1) // add thread number of thread man thread wait to complete
	go sendTicket(20)

	fmt.Println("completed")

	wg.Wait() // wait for other added therad to complete

	//go uses green thread -- > abstraction of actual thread

}

// func name_func(delclare parameters ) return type
func add(a int, b int) int {
	fmt.Println("inside add func", a)

	return a + b
}

func modify(firstNam []string) {
	firstNam[0] = "mmmmmmm"
	fmt.Println(firstNam, "inside modify")
}

func modifyarr(firstNam *[50]int) {
	firstNam[0] = 1111
	fmt.Println(firstNam, "inside modify", firstNam, *firstNam)
}

func multipleValue(str string, a int, b int) (string, int, int) {

	return str, a + b, a - b
}

func Mul(a int, b int) int {
	return a * b
}

func sendTicket(no int) {
	time.Sleep(10 * time.Second)
	fmt.Println("sending ===========", no)
	wg.Done() //removes the thread from waith froup
}

package main

import "fmt"

func main() {
	fmt.Println("hello world")
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

/*
4
99
110
121
122
---
YES
YES
YES
YES
======
2
98
109
---
NO
NO

*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int
	scanf("%d\n", &n)

	for d := 0; d < 11; d++ {
		a := n - d*111
		if a > 0 && a%11 == 0 {
			fmt.Fprintln(writer, "YES")
			return
		}
	}

	fmt.Fprintln(writer, "NO")
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

/*
4
99
110
121
122
---
YES
YES
YES
YES
======
2
98
109
---
NO
NO

*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int
	scanf("%d\n", &n)

	for d := 0; d <= 11; d++ {
		a := n - d*111
		if a > 0 && a%11 == 0 {
			fmt.Fprintln(writer, "YES")
			return
		}
	}

	fmt.Fprintln(writer, "NO")
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

const M = 1e9 + 7;
const MAXN = 2e3 + 5;

var bytes []byte;

func nextByte() byte {
	b := bytes[0];
	bytes = bytes[1:];
	return b;
}

func ScanInt64() int64 {
	var negative bool;
	var result int64;
	b := nextByte();
	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true;
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0');
	}

	if negative {
		return -result;
	} else {
		return result;
	}
}

func ScanInt() int {
	return int(ScanInt64());
}

func ScanString() string {
	builder := strings.Builder{};

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b);
		}
	}
	return builder.String();
}

func init() {
	if (len(os.Args) > 1 && os.Args[1] == "LOCAL_JUDGE") {
		stdin, _ := os.OpenFile("input.txt", os.O_RDONLY | os.O_CREATE, 0666);
		stdout, _ := os.OpenFile("output.txt", os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0666);
		os.Stdin = stdin;
		os.Stdout = stdout;
	}
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin));
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		x := ScanInt();
		flag := true;
		for i := 0; i < 11; i++ {
			if x > (i * 111) {
				break;
			}
			if (x - (i * 111)) % 11 == 0 {
				fmt.Printf("YES\n");
				flag = false;
			}
		}
		if (flag) {
			fmt.Printf("NO\n");
		}
	}
	return;
}

package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

const M = 1e9 + 7;
const MAXN = 2e3 + 5;

var bytes []byte;

func nextByte() byte {
	b := bytes[0];
	bytes = bytes[1:];
	return b;
}

func ScanInt64() int64 {
	var negative bool;
	var result int64;
	b := nextByte();
	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true;
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0');
	}

	if negative {
		return -result;
	} else {
		return result;
	}
}

func ScanInt() int {
	return int(ScanInt64());
}

func ScanString() string {
	builder := strings.Builder{};

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b);
		}
	}
	return builder.String();
}

func init() {
	if (len(os.Args) > 1 && os.Args[1] == "LOCAL_JUDGE") {
		stdin, _ := os.OpenFile("input.txt", os.O_RDONLY | os.O_CREATE, 0666);
		stdout, _ := os.OpenFile("output.txt", os.O_WRONLY | os.O_CREATE | os.O_TRUNC, 0666);
		os.Stdin = stdin;
		os.Stdout = stdout;
	}
	bytes, _ = ioutil.ReadAll(bufio.NewReader(os.Stdin));
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		x := ScanInt();
		flag := true;
		for i := 0; i < 11; i++ {
			if x > (i*111) &&  (x - (i * 111)) % 11 == 0 {
				fmt.Printf("YES\n");
				flag = false;
			}
		}
		if (flag) {
			fmt.Printf("NO\n");
		}
	}
	return;
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	scn  = bufio.NewReader(os.Stdin)
	prnt = bufio.NewWriter(os.Stdout)
)

func main() {
	var t int
	fmt.Fscan(scn, &t)
	for i := 0; i < t; i++ {
		var n int64
		fmt.Fscan(scn, &n)
		k := 110
		m := n % 11
		if int64(m)*int64(k) <= n {
			fmt.Fprintln(prnt, "YES")
		} else {
			fmt.Fprintln(prnt, "NO")
		}
	}

}

func min(a ...int) int {
	mn := a[0]
	length := len(a)
	for i := 0; i < length; i++ {
		if a[i] < mn {
			mn = a[i]
		}
	}
	return mn
}

func max(a ...int) int {
	mx := a[0]
	length := len(a)
	for i := 0; i < length; i++ {
		if a[i] > mx {
			mx = a[i]
		}
	}
	return mx
}

func queue(queue []int, element int) []int {
	queue = append(queue, element)
	return queue
}

func dequeue(queue []int) []int {
	return queue[1:]
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}