#include <cstdio>
#include <cstring>
#include <cmath>

const int PSIZE = 1000010;
int plist[PSIZE], pcount = 0;
int s1[1000001], s2[1000001];
bool prime(int n) {
	if (( n != 2 && !(n % 2)) || ( n != 3 && !(n % 3)) || ( n != 5 && !(n % 5) ) || (n != 7 && !(n % 7))) { return false; }
	for (int i = 0; plist[i] * plist[i] <= n; ++i) {
		if (n % plist[i] == 0) {
			return false;
		}
	}
	return (n > 1);
}
void initPrime() {
	plist[pcount++] = 2;
	for (int i = 3; i <= 1000000; i+=2) {
		if (prime(i)) { plist[pcount++] = i; }
	}
}
int primeFactor(int n, int *f, int *nf) {
	int cnt = 0;
	int n2 = (int) sqrt((double)n);
	for (int i = 0; n > 1 && plist[i] <= n2; ++i) {
		if (n % plist[i] == 0) {
			for (nf[cnt] = 0; n % plist[i] == 0; n /= plist[i]) {
				++nf[cnt];
			}
			f[cnt++] = plist[i];
		}
	}
	if (n > 1) {
		nf[cnt] = 1;
		f[cnt++] = n; 
	}
	return cnt;
}

int main() {

	initPrime();
	int cas;
	scanf("%d", &cas);
	while(cas--) {
		int n;
		scanf("%d", &n);
		int w = primeFactor(n, s1, s2);
		int ans = 1;
		for (int j = 0; j < w; ++j) if (s2[j] > ans) ans = (s2[j]); 
		printf("%d\n", ans);
	}	
	return 0;
}

