February Easy Challenge 2015  is underway. Hackerearth welcomes you all and hope that all you awesome coders have a great time. So without wasting much of the time let's begin the contest.  

Prime Numbers have always been one of the favourite topics for problem setters. For more information on them you can use see this link http://en.wikipedia.org/wiki/Prime_number .  

Aishwarya is a mathematics student at the Department of Mathematics and Computing, California. Her teacher recently gave her an intriguing assignment with only a single question. The question was to find out the minimum number of single digit prime numbers which when summed equals a given number X. 

Input:
The first line contains T denoting the number of test cases. Each of the next T lines contains a single integer X.  

Output:
Print the minimum number required.  If it is not possible to obtain X using single digit prime numbers, output -1.  

Constraints:
1 ≤ T ≤ 100
1 ≤ X ≤ 10^6  

SAMPLE INPUT
4
7
10
14
11

SAMPLE OUTPUT
1
2
2
3

Explanation

10 can be represented as 7 + 3.

14 can be represented as 7+7

11 can be represented as 5+3+3.
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#t=inprint 'Hello World!'

		
		

		
for i in range(input()):
	x=input()
	if(x==1):
		print "-1"
		continue
	p=x/7
	r=x%7
	if(r==1 or r==2 or r==3 or r==5):
		p+=1
	if(r==4 or r==6):
		p+=2
	print p