'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
inp =int( raw_input())
ls =[]
for i in range(0,int(inp)):
	a = int(raw_input())
	ls.append(a)
	del(a)
for i in range(0,len(ls)):
	if ls[i] == 0:
		print (0)
		continue;
	elif ls[i] <3:
		print(1)
		continue;
	elif ls[i]%3==0:
		print(ls[i]/3)
		continue
	else:
		print(ls[i])
		continue