#!/bin/python3

import sys

def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac
t = int(input().strip())
for a0 in range(t):
    n = int(input().strip())
    print(max(primes(n)))

577d735ad79f30b5d605bf92fa9bf3d2f9acf94b
<mask token>


def primes(n):
    primfac = []
    d = 2
    while d * d <= n:
        while n % d == 0:
            primfac.append(d)
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac


<mask token>

<mask token>


def primes(n):
    primfac = []
    d = 2
    while d * d <= n:
        while n % d == 0:
            primfac.append(d)
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac


<mask token>
for a0 in range(t):
    n = int(input().strip())
    print(max(primes(n)))

<mask token>


def primes(n):
    primfac = []
    d = 2
    while d * d <= n:
        while n % d == 0:
            primfac.append(d)
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac


t = int(input().strip())
for a0 in range(t):
    n = int(input().strip())
    print(max(primes(n)))

import sys


def primes(n):
    primfac = []
    d = 2
    while d * d <= n:
        while n % d == 0:
            primfac.append(d)
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac


t = int(input().strip())
for a0 in range(t):
    n = int(input().strip())
    print(max(primes(n)))

#!/bin/python3

import sys

def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
        primfac.append(n)
    return primfac
t = int(input().strip())
for a0 in range(t):
    n = int(input().strip())
    print(max(primes(n)))
