The citizens of Byteland regularly play a game. They have blocks each denoting some integer from 0 to 9. These are arranged together in a random manner without seeing to form different numbers keeping in mind that the first block is never a 0. Once they form a number they read in the reverse order to check if the number and its reverse is the same. If both are same then the player wins. We call such numbers palindrome. 
Ash happens to see this game and wants to simulate the same in the computer. As the first step he wants to take an input from the user and check if the number is a palindrome and declare if the user wins or not. 

------ Input ------ 

The first line of the input contains T, the number of test cases. This is followed by T lines containing an integer N.

------ Output ------ 

For each input output "wins" if the number is a palindrome and "loses" if not, in a new line.

------ Constraints ------ 

1≤T≤20 

1≤N≤20000 

----- Sample Input 1 ------ 
3
331
666
343
----- Sample Output 1 ------ 
loses
wins
wins

Difficulty: EASY
Tags: Mathematics

String algorithms

Data structures

Implementation
Skill types: Data structures

Starter code:

Solutions:
n = int(input())
for i in range(n):
	p = int(input())
	print('wins') if p == int(''.join(reversed(list(str(p))))) else print('loses')


t = int(input())
for _ in range(t):
	N = int(input())
	x = str(N)[::-1]
	print('wins') if N == int(x) else print('loses')


t = int(input())
for i in range(t):
	a = input()
	if a == a[::-1]:
		print('wins')
	else:
		print('loses')


for _ in range(int(input())):
	n = int(input())
	s = str(n)
	if s[::-1] == s:
		print('wins')
	else:
		print('loses')


def check(num):
	if num[::-1] == num:
		return True
	return False
for T in range(int(input())):
	N = input()
	print('wins' if check(N) else 'loses')


for i in range(int(input())):
	n = input()
	print('wins') if n == n[::-1] else print('loses')


for i in range(int(input())):
	s = str(int(input()))
	n = len(s)
	l = []
	m = []
	for i in range(n):
		l.append(s[i])
		m.append(s[n - i - 1])
	if l == m:
		print('wins')
	else:
		print('loses')


def pal(n):
	o = n
	s = 0
	while n > 0:
		s = s * 10 + n % 10
		n //= 10
	if s == o:
		return 'wins'
	else:
		return 'loses'
for i in range(int(input())):
	n = int(input())
	print(pal(n))


n = int(input())
for i in range(n):
	t = int(input())
	t = str(t)
	w = t[::-1]
	if t == w:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	a = input()
	p = str(a)[::-1]
	if a == p:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	n = input()
	l = reversed(n)
	if list(n) == list(l):
		print('wins')
	else:
		print('loses')


t = int(input())
while t > 0:
	N = input()
	if N != N[::-1]:
		print('loses')
	else:
		print('wins')
	t -= 1


def es_polindrome(n):
	s = str(n)
	return s == s[::-1]
T = int(input())
for i in range(T):
	N = int(input())
	if es_polindrome(N):
		print('wins')
	else:
		print('loses')


n = int(input())
for i in range(1, n + 1):
	x = int(input())
	rev = 0
	temp = x
	while x != 0:
		d = x % 10
		rev = rev * 10 + d
		x = x // 10
	if rev == temp:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	n = int(input())
	rev = 0
	tem = n
	while n > 0:
		a = n % 10
		rev = rev * 10 + a
		n = n // 10
	if tem == rev:
		print('wins')
	else:
		print('loses')


test_case = int(input())
for i in range(0, test_case):
	N = input()
	if N[::-1] == N:
		print('wins')
	else:
		print('loses')


def fun(n):
	if n[::-1] == n:
		return True
	return False
for i in range(int(input())):
	x = input()
	print('wins' if fun(x) else 'loses')


N = int(input())
for i in range(N):
	num = input()
	if num == num[::-1]:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	a = input()
	b = ''.join(reversed(a))
	if a == b:
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	s = input()
	s1 = s[::-1]
	if s == s1:
		print('wins')
	else:
		print('loses')


def is_palindrome(n):
	s = str(n)
	s_rev = s[::-1]
	if s == s_rev:
		return True
	else:
		return False

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if is_palindrome(n):
			print('wins')
		else:
			print('loses')
main()


t = int(input())
for i in range(t):
	n = int(input())
	temp = n
	rev = 0
	while temp > 0:
		rem = temp % 10
		rev = rev * 10 + rem
		temp = temp // 10
	if rev == n:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	k1 = input()
	k2 = k1[::-1]
	if k1 == k2:
		print('wins')
	else:
		print('loses')


casos = int(input())
cont = 0
lista = []
while cont < casos:
	palabra = list(input())
	abralap = palabra[::-1]
	if palabra == abralap:
		lista.append('wins')
	else:
		lista.append('loses')
	cont += 1
for i in range(len(lista)):
	print(lista[i])


def cha(num):
	if num[::-1] == num:
		return True
	return False
for a in range(int(input())):
	n = input()
	print('wins' if cha(n) else 'loses')


t = int(input())
while t > 0:
	p = ''
	n = int(input())
	a = str(n)
	p = a[::-1]
	if a == p:
		print('wins')
	else:
		print('loses')
	t -= 1


T = int(input())
for i in range(T):
	inp_num = input()
	rev = inp_num[::-1]
	if inp_num == rev:
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	N = int(input())
	rev = 0
	temp = N
	while N > 0:
		d = N % 10
		rev = rev * 10 + d
		N = N // 10
	if temp == rev:
		print('wins')
	else:
		print('loses')


for _ in range(int(input())):
	a = input()
	if a == a[::-1]:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	m = int(input())
	n = str(m)
	if n[0:] == n[::-1]:
		print('wins')
	else:
		print('loses')


casos = int(input())
contador = 0
lista1 = []
while contador < casos:
	palabra = list(input())
	abralap = palabra[::-1]
	if palabra == abralap:
		lista1.append('wins')
	else:
		lista1.append('loses')
	contador += 1
for i in range(len(lista1)):
	print(lista1[i])


def es_palindromo(num):
	num_str = str(num)[::-1]
	if num_str == str(num):
		return True
	else:
		return False
T = int(input())
for i in range(T):
	N = int(input())
	if es_palindromo(N):
		print('wins')
	else:
		print('loses')


t = int(input())
for _ in range(t):
	n = input()
	k = n[::-1]
	if n == k:
		print('wins')
	else:
		print('loses')


t = int(input())
while t > 0:
	n = input()
	if n == n[::-1]:
		print('wins')
	else:
		print('loses')
	t = t - 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(n)
	s2 = ''
	for i in range(len(s) - 1, -1, -1):
		s2 += s[i]
	if s == s2:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	n = int(input())
	n1 = str(n)
	n2 = n1[::-1]
	if n == int(n2):
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	x = int(input())
	if str(x) == str(x)[::-1]:
		print('wins')
	else:
		print('loses')


T = int(input())
for i in range(T):
	n = int(input())
	a = str(n)
	if a == a[::-1]:
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	n = int(input())
	b = 0
	temp = n
	while temp != 0:
		a = temp % 10
		b = b * 10 + a
		temp //= 10
	if b == n:
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	n = int(input())
	s = n
	sum = 0
	while n > 0:
		r = n % 10
		sum = sum * 10 + r
		n = n // 10
	if sum == s:
		print('wins')
	else:
		print('loses')


t = int(input())

def check(num):
	if num[::-1] == num:
		print('wins')
	else:
		print('loses')
for i in range(t):
	x = input()
	check(x)


import math
t = int(input())
for i in range(t):
	n = int(input())
	c = int(math.log10(n))
	t = n
	s = 0
	while n != 0:
		r = n % 10
		s = s + r * 10 ** c
		c = c - 1
		n = n // 10
	if t == s:
		print('wins')
	else:
		print('loses')


def main():
	t = input()
	for i in range(int(t)):
		num = input()
		temp = ''
		for n in num:
			temp = n + temp
		if temp == num:
			print('wins')
		else:
			print('loses')
main()


def is_palindrome(n):
	rev = str(n)[::-1]
	if str(n) == rev:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	n = int(input())
	if is_palindrome(n):
		print('wins')
	else:
		print('loses')


s = int(input())

def isPalindrome(s):
	return s == s[::-1]
for i in range(s):
	t = input()
	ans = isPalindrome(t)
	if ans:
		print('wins')
	else:
		print('loses')


for t in range(int(input())):
	n = input()
	r = n[-1::-1]
	if n == r:
		print('wins')
	else:
		print('loses')


for i in range(int(input())):
	s = input()
	l = s[::-1]
	if l == s:
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	m = input()
	n = list(m)
	if n == list(reversed(n)):
		print('wins')
	else:
		print('loses')


t = int(input())
for j in range(t):
	i = int(input())
	rev = 0
	a = i
	while i > 0:
		rev = rev * 10 + i % 10
		i = i // 10
	if a == rev:
		print('wins')
	else:
		print('loses')


t = int(input())
for i in range(t):
	m = 0
	n = input()
	k = ''
	for j in n:
		k = j + k
	if n == k:
		print('wins')
	else:
		print('loses')


casos = int(input())
ciclo = 1
while ciclo <= casos:
	numero = input()
	lista = []
	for i in numero:
		lista.append(i)
	total = len(lista) - 1
	if lista[total] == lista[0]:
		print('wins')
	if lista[total] != lista[0]:
		print('loses')
	ciclo += 1


for _ in range(int(input())):
	N = int(input())
	t = N
	sum = 0
	while N > 0:
		sum = sum * 10 + N % 10
		N //= 10
	if sum == t:
		print('wins')
	else:
		print('loses')


x = int(input())
for i in range(x):
	m = 0
	n = int(input())
	y = n
	while n > 0:
		r = n % 10
		m = m * 10 + r
		n = n // 10
	if m == y:
		print('wins')
	else:
		print('loses')