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.

// AUTHOR : MAYANK SUNAL
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	int p;
	int s;

	Main(int p, int s) {
		this.p = p;
		this.s = s;
	}

	static final Random random = new Random();
	static PrintWriter out = new PrintWriter((System.out));
	static Reader sc = new Reader();

	public static void main(String args[]) throws IOException {
		int t = sc.nextInt();
		while (t-- > 0) {
//        	CODE START FROM HERE 
			int n = sc.nextInt();
			ArrayList<Integer> a = new ArrayList<Integer>();
			a.add(0);
			a.add(2);
			boolean mainflag = true;
			if (n < 2) {
				System.out.println(0);
				mainflag = false;
			}
			if (mainflag) {
				boolean flag = true;
				for (int i = 2; a.get(i - 1) <= n; i++) {
					a.add(i, 2 * i + a.get(i - 1) + i - 1);
					if (a.get(i) == n || a.get(i - 1) == n) {
						System.out.println(1);
						flag = false;
						break;
					}
				}

				if (flag) {
					int count = 1;
					int rem = n - a.get(a.size() - 2);
					if (rem < 2)
						System.out.println(count);
					else {
						for (int i = a.size() - 2; i >= 1; i--) {
							if (rem < 2)
								break;
							if (a.get(i) <= rem) {
								count += rem / a.get(i);
								rem = rem % a.get(i);
							}
						}
						System.out.println(count);
					}
				}
			}
//			System.out.println(a);

		}

	}

// }
// Fast Input Output
	static class Reader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			try {
				return br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return null;
		}

		public boolean hasNext() {
			String next = null;
			try {
				next = br.readLine();
			} catch (Exception e) {
			}
			if (next == null) {
				return false;
			}
			st = new StringTokenizer(next);
			return true;
		}

	}

	// EFFICIENT SORTING Ascending
	static void ruffleSortAsc(Integer[] a) {
		int n = a.length; // shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a);
	}

//	EFFICIENT SORTING Descending
	static void ruffleSortDesc(Integer[] a) {
		int n = a.length; // shuffle, then sort
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a, Collections.reverseOrder());
	}

	// Array Sum
	static long sum(Integer[] arr) {
		long sum = 0;
		for (int i : arr)
			sum += i;
		return sum;
	}

	// ArrayList Sum
	static long sumal(ArrayList<Integer> al) {
		long sum = 0;
		for (int i : al)
			sum += i;
		return sum;
	}

	// swap array elements
	static void swap(int arr1[], int arr2[], int i, int j) {
		int temp = arr1[i];
		arr1[i] = arr2[j];
		arr2[j] = temp;
	}

	// reading array value;
	static void read(Integer[] arr) {
		for (int i = 0; i < arr.length; i++)
			arr[i] = sc.nextInt();
		return;
	}

//    reading arraylistValue

	static void readal(List<Integer> l, int n) {
		for (int i = 0; i < n; i++)
			l.add(sc.nextInt());
		return;
	}

	// check for even odd
	static boolean isEven(long n) {
		return ((n & 1) != 1);
	}

	// max in a array
	static int max(Integer[] arr) {
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < arr.length; i++)
			if (max < arr[i])
				max = arr[i];
		return max;
	}

//  print array
	static void printarr(Integer arr[]) {
		for (int i : arr)
			System.out.println(i);
	}

// ceil of two elements
	static int ceil(long l, int b) {
		return (int) Math.ceil(((double) l / (double) b));
	}

// floor of two elements
	static int floor(int a, int b) {
		return (int) Math.floor(((double) a / (double) b));
	}
}