You are given a string s of length 8 consisting solely of '0's and '1's. Assume that the characters of the string are written in a circular fashion. You need to find the number of 0-1 or 1-0 transitions that one has to make while making a single traversal over the string. ie. start from any character and go circularly until you get back to the same character, and find the number of transitions that you made. The string is said to be said to be uniform if there are at most two such transitions. Otherwise, it is called non-uniform.
Given the string s, tell whether the string is uniform or not.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of input contains the string s.

-----Output-----
For each test case, output "uniform" if the given string is uniform and "non-uniform" otherwise.

-----Constraints-----
- 1 ≤ T ≤ 256
- Length of s is 8

-----Example-----
Input
4
00000000
10101010
10000001
10010011

Output
uniform
non-uniform
uniform
non-uniform

-----Explanation-----
The number of transitions are 0, 8, 2 and 4 for the respective cases. So, the first and third one are uniform while the second and fourth one are non-uniform.

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
n = int(input())
for i in range(n):
	count = 0
	s = input()
	for i in range(1, len(s)):
		if s[i - 1] != s[i]:
			count += 1
	if s[0] != s[-1]:
		count += 1
	print('uniform' if count <= 2 else 'non-uniform')


for i in range(int(input())):
	n = input()
	t = n.count('10') + n.count('01')
	if n[-1] != n[0]:
		t += 1
	print('uniform' if t <= 2 else 'non-uniform')


for i in range(int(input())):
	x = input()
	c = x.count('10') + x.count('01')
	if x[-1] != x[0]:
		c += 1
	print('uniform' if c <= 2 else 'non-uniform')


for t in range(int(input())):
	a = input()
	if a.count('10') + a.count('01') > 2:
		print('non-uniform')
	else:
		print('uniform')


for _ in range(int(input())):
	s = input()
	if s.count('10') + s.count('01') > 2:
		print('non-uniform')
	else:
		print('uniform')


n = int(input())
for i in range(n):
	s = input()
	if s.count('10') + s.count('01') > 2:
		print('non-uniform')
	else:
		print('uniform')


t = int(input())
for i in range(t):
	n = input()
	co = 0
	m = n[0]
	for j in range(1, len(n)):
		if m != n[j]:
			co += 1
			m = n[j]
		if co > 2:
			print('non-uniform')
			break
	if co <= 2:
		print('uniform')


test_case = int(input())
for i in range(0, test_case):
	string = input()
	if string.count('10') + string.count('01') > 2:
		print('non-uniform')
	else:
		print('uniform')


for _ in range(int(input())):
	n = input()
	count = 0
	for j in range(0, len(n) - 1):
		if n[j] != n[j + 1]:
			count += 1
	if n[0] != n[-1]:
		count = count + 1
	if count <= 2:
		print('uniform')
	else:
		print('non-uniform')


def uniformString(s):
	res = s.count('10') + s.count('01')
	if res <= 2:
		print('uniform')
	else:
		print('non-uniform')
	return
t = int(input())
for _ in range(t):
	s = input()
	uniformString(s)


t = int(input())
s = []
for i in range(t):
	c = 0
	a = input()
	if a[0] != a[7]:
		c += 1
	for i in range(0, 6):
		if a[i] != a[i + 1]:
			c += 1
	s.append(c)
for i in s:
	if i <= 2:
		print('uniform')
	else:
		print('non-uniform')


val = int(input())
for i in range(val):
	p = input()
	p = str(p)
	b = p.count('10') + p.count('01')
	if b <= 2:
		print('uniform')
	else:
		print('non-uniform')


def check(arr):
	c = 0
	for i in range(len(arr)):
		if i == len(arr) - 1:
			if arr[i] != arr[0]:
				c += 1
		elif arr[i] == '0' and arr[i + 1] == '1':
			c += 1
		elif arr[i] == '1' and arr[i + 1] == '0':
			c += 1
		if c > 2:
			return 'non-uniform'
	return 'uniform'
for __ in range(int(input())):
	arr = input()
	k = check(arr)
	print(k)


for _ in range(int(input())):
	s = input()
	count = 0
	for i in range(8):
		count += s[i] != s[i - 1]
	print('uniform') if count <= 2 else print('non-uniform')


t = int(input())
l = []
for i in range(t):
	count = 0
	a = input()
	if a[0] != a[7]:
		count += 1
	for i in range(0, 6):
		if a[i] != a[i + 1]:
			count += 1
	l.append(count)
for i in l:
	if i <= 2:
		print('uniform')
	else:
		print('non-uniform')


t = int(input())
for _ in range(t):
	s = input()
	c = 0
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			c += 1
	if c <= 2:
		print('uniform')
	else:
		print('non-uniform')


t = int(input())
for T in range(t):
	n = input()
	lenn = len(n)
	oz = 0
	zo = 0
	for i in range(lenn - 1):
		if n[i] == '0' and n[i + 1] == '1':
			zo += 1
		elif n[i] == '1' and n[i + 1] == '0':
			oz += 1
		else:
			pass
	if n[lenn - 1] == '1' and n[0] == '0':
		oz += 1
	elif n[lenn - 1] == '0' and n[0] == '1':
		zo += 1
	else:
		pass
	if oz + zo <= 2:
		print('uniform')
	else:
		print('non-uniform')


T = int(input())
for _ in range(T):
	a = input()
	c = 0
	i = 1
	curr = a[0]
	while i < 8:
		if a[i] != curr:
			curr = a[i]
			c = c + 1
		i = i + 1
	if a[0] != a[7]:
		c = c + 1
	if c <= 2:
		print('uniform')
	else:
		print('non-uniform')