import fileinput
def MinimumFlip(NumCard):
    Cards=NumCard
    if Cards%3==0:
        print Cards/3
    elif Cards==2 or Cards==1:
        print "1"
    elif Cards==0:
    	print "0"       
    else:        
        print Cards

inp=[]
for line in fileinput.input():
	inp.append(line.strip())
T=int(inp[0])
if 1<=T<=100000:
    for i in xrange(1,T+1):
        N=int(inp[i])
        if 0<=N<=(10**15):
            MinimumFlip(N)