A card pyramid of height 1 is constructed by resting two cards against each other. For h>1, a card pyramid of height h is constructed by placing a card pyramid of height h-1 onto a base. A base consists of h pyramids of height 1, and h-1 cards on top. For example, card pyramids of heights 1, 2, and 3 look as follows:

<image>

You start with n cards and build the tallest pyramid that you can. If there are some cards remaining, you build the tallest pyramid possible with the remaining cards. You repeat this process until it is impossible to build another pyramid. In the end, how many pyramids will you have constructed?

Input

Each test consists of multiple test cases. The first line contains a single integer t (1≤ t≤ 1000) — the number of test cases. Next t lines contain descriptions of test cases.

Each test case contains a single integer n (1≤ n≤ 10^9) — the number of cards.

It is guaranteed that the sum of n over all test cases does not exceed 10^9.

Output

For each test case output a single integer — the number of pyramids you will have constructed in the end.

Example

Input


5
3
14
15
24
1


Output


1
2
1
3
0

Note

In the first test, you construct a pyramid of height 1 with 2 cards. There is 1 card remaining, which is not enough to build a pyramid.

In the second test, you build two pyramids, each of height 2, with no cards remaining.

In the third test, you build one pyramid of height 3, with no cards remaining.

In the fourth test, you build one pyramid of height 3 with 9 cards remaining. Then you build a pyramid of height 2 with 2 cards remaining. Then you build a final pyramid of height 1 with no cards remaining.

In the fifth test, one card is not enough to build any pyramids.
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
 
import static java.lang.Math.*;
 
public class MakingString implements Runnable 
{
    static class InputReader 
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        public InputReader(InputStream stream) 
        {
            this.stream = stream;
        }
        
        public int read()
        {
            if (numChars==-1) 
                throw new InputMismatchException();
            
            if (curChar >= numChars) 
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                
                if(numChars <= 0)               
                    return -1;
            }
            return buf[curChar++];
        }
     
        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() 
        {
            int c = read();
            
            while(isSpaceChar(c)) 
                c = read();
            
            int sgn = 1;
        
            if (c == '-') 
            {
                sgn = -1;
                c = read();
            }
            
            int res = 0;
            do
            {
                if(c<'0'||c>'9') 
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); 
        
            return res * sgn;
        }
        
        public long nextLong() 
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;
            
            do 
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }
        
        public double nextDouble() 
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') 
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
    
        public String readString() 
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do 
            {
                res.appendCodePoint(c);
                c = read();
            } 
            while (!isSpaceChar(c));
            
            return res.toString();
        }
     
        public boolean isSpaceChar(int c) 
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
     
        public String next()
        {
            return readString();
        }
        
        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
	
	
	// if modulo is required set value accordingly
	public static long[][] matrixMultiply2dL(long t[][],long m[][])
	{
		long res[][]= new long[t.length][m[0].length];
		
		for(int i=0;i<t.length;i++)
		{
			for(int j=0;j<m[0].length;j++)
			{
				res[i][j]=0;
				for(int k=0;k<t[0].length;k++)
				{
					res[i][j]+=t[i][k]+m[k][j];
				}
			}
		}
		
		return res;
	}
	
	static long combination(long n,long r)
	{
		long ans=1;
		for(long i=0;i<r;i++)
		{
			ans=(ans*(n-i))/(i+1);
		}
		return ans;
	}
	static int mat(String a,String b)
	{
	    int count=0;
	    for(int i=0;i<a.length();i++)
	    {
	        if(a.charAt(i)!=b.charAt(i))
	            count++;
	        
	    }
	    
	    return count;
	}
	
	static int accumulate(int arr[], int first, 
                                     int last) 
    { 
        int init = 0; 
        for (int i = first; i< last; i++) { 
            init = init + arr[i]; 
        } 
      
        return init; 
    } 
  
    // Returns true if it is possible to divide  
    // array into two halves of same sum.  
    // This function mainly uses combinationUtil() 
    static Boolean isPossible(int arr[], int n) 
    { 
        // If size of array is not even. 
        if (n % 2 != 0) 
            return false; 
  
        // If sum of array is not even. 
        int sum = accumulate(arr, 0, n); 
        if (sum % 2 != 0) 
            return false; 
  
        // A temporary array to store all  
        // combination one by one int k=n/2; 
        int half[] = new int[n/2]; 
  
        // Print all combination using temporary 
        // array 'half[]' 
        return combinationUtil(arr, half, 0, n - 1, 
                                0, n, sum); 
    } 
  
    /* arr[] ---> Input Array 
    half[] ---> Temporary array to store current  
                combination of size n/2 
    start & end ---> Staring and Ending indexes in arr[] 
    index ---> Current index in half[] */
    static Boolean combinationUtil(int arr[], int half[],  
                                   int start, int end, 
                                   int index, int n, 
                                   int sum) 
    { 
        // Current combination is ready to  
        // be printed, print it 
        if (index == n / 2) { 
            int curr_sum = accumulate(half, 0 , n/2); 
            return (curr_sum + curr_sum == sum); 
        } 
  
        // replace index with all possible elements.  
        // The condition "end-i+1 >= n/2-index" makes 
        // sure that including one element at index  
        // will make a combination with remaining 
        // elements at remaining positions 
        for (int i = start; i <= end && end - i + 1 >=  
                                  n/2 - index; i++) { 
            half[index] = arr[i]; 
            if (combinationUtil(arr, half, i + 1, end,  
                                 index + 1, n, sum)) 
                return true; 
        } 
  
        return false; 
    } 
    public static void main(String args[]) throws Exception 
    {
        new Thread(null, new MakingString(),"MakingString",1<<27).start();
    }
	// **just change the name of class from Main to reuquired**
    public void run()
    {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
		
	    
	    
	    
	        int n = sc.nextInt();
	        for(int j=0;j<n;j++)
	        {
	           int n1 = sc.nextInt();
	           List<Integer> list = new ArrayList<>();
	           int sum=0;
	           int k=1;
	           while(sum<n1)
	           {
	               int temp = 2*k + k-1;
	               k++;
	               sum=sum+temp;
	               list.add(sum);
	           }
	           int count=0;
	        for(int i=list.size()-1;i>=0;i--)
	        {
	            if(n1>list.get(i))
	            {
	                count++;
	                n1=n1-list.get(i);
	                i++;
	            }
	            else if(n1==list.get(i))
	            {
	                count++;
	                break;
	                
	            }
	            else if(n1<list.get(i))
	            {
	                continue;
	                
	            }
	        }
	           w.println(count);
	           
	        }
	        
	        
	        
	        
	        
	    
        
    
	    
	    
        System.out.flush();
        w.close();
        
    }
}