Recently Vova found $n$ candy wrappers. He remembers that he bought $x$ candies during the first day, $2x$ candies during the second day, $4x$ candies during the third day, $\dots$, $2^{k-1} x$ candies during the $k$-th day. But there is an issue: Vova remembers neither $x$ nor $k$ but he is sure that $x$ and $k$ are positive integers and $k > 1$.

Vova will be satisfied if you tell him any positive integer $x$ so there is an integer $k>1$ that $x + 2x + 4x + \dots + 2^{k-1} x = n$. It is guaranteed that at least one solution exists. Note that $k > 1$.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases. Then $t$ test cases follow.

The only line of the test case contains one integer $n$ ($3 \le n \le 10^9$) — the number of candy wrappers Vova found. It is guaranteed that there is some positive integer $x$ and integer $k>1$ that $x + 2x + 4x + \dots + 2^{k-1} x = n$.


-----Output-----

Print one integer — any positive integer value of $x$ so there is an integer $k>1$ that $x + 2x + 4x + \dots + 2^{k-1} x = n$.


-----Example-----
Input
7
3
6
7
21
28
999999999
999999984

Output
1
2
1
7
4
333333333
333333328



-----Note-----

In the first test case of the example, one of the possible answers is $x=1, k=2$. Then $1 \cdot 1 + 2 \cdot 1$ equals $n=3$.

In the second test case of the example, one of the possible answers is $x=2, k=2$. Then $1 \cdot 2 + 2 \cdot 2$ equals $n=6$.

In the third test case of the example, one of the possible answers is $x=1, k=3$. Then $1 \cdot 1 + 2 \cdot 1 + 4 \cdot 1$ equals $n=7$.

In the fourth test case of the example, one of the possible answers is $x=7, k=2$. Then $1 \cdot 7 + 2 \cdot 7$ equals $n=21$.

In the fifth test case of the example, one of the possible answers is $x=4, k=3$. Then $1 \cdot 4 + 2 \cdot 4 + 4 \cdot 4$ equals $n=28$.

Difficulty: EASY

Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	j = 0
	while True:
		j = 2 ** k
		if n % (j - 1) == 0:
			break
		k = k + 1
	print(n // (j - 1))


for _ in range(int(input())):
	n = int(input())
	ans = -1
	v = 4
	while True:
		val = v - 1
		if n % val == 0:
			ans = n // val
			break
		v *= 2
	print(ans)


import math
n = int(input())
d = []

def check(p):
	for k in range(2, p):
		if p % (math.pow(2, k) - 1) == 0:
			t = int(p / (math.pow(2, k) - 1))
			return d.append(str(t))
		else:
			continue
for i in range(n):
	b = int(input())
	check(b)
for x in d:
	print(x)


def checks(c):
	d = (2 ** c - 1) / (2 - 1)
	return d
t = int(input())
for i in range(1, t + 1):
	n = float(input())
	x = 1
	a = 2
	while x > 0:
		s = checks(a)
		if n % s == 0:
			print(int(n / s))
			break
		a += 1


def answer():
	n = int(input())
	k = 1
	for i in range(1, n):
		k += 2 ** i
		if n % k == 0:
			print(n // k)
			return
t = int(input())
for i in range(t):
	answer()


for test in range(int(input())):
	n = int(input())
	sum = 0
	for i in range(n + 1):
		sum += 2 ** i
		if n % sum == 0 and i != 0:
			print(n // sum)
			break


t = int(input())
for j in range(t):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


q = int(input())
for i in range(q):
	n = int(input())
	k = 2
	while True:
		div = 2 ** k - 1
		if n % div == 0:
			x = n // div
			print(x)
			break
		k += 1


from math import *
for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		gp = int(2 ** k - 1)
		if n % gp == 0:
			break
		k += 1
	x = n // gp
	print(x)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	for i in range(2, 31):
		t = (1 << i) - 1
		if n % t == 0:
			ans = n // t
			break
	print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			print(x)
			break
		k += 1


t = int(input())

def fu(n):
	j = 3
	if n % j == 0:
		return n // j
	else:
		for k in range(2, 100):
			j = j + 2 ** k
			if n % j == 0:
				return n // j
for i in range(t):
	n = int(input())
	print(fu(n))


for _ in range(int(input())):
	n = int(input())
	i = 3
	k = 1 + 1
	while n % i != 0:
		k *= 1 + 1
		i += k
	print(n // i)


from sys import stdin, stdout
p2 = []
for i in range(2, 35):
	p2 += [(1 << i) - 1]
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	for v in p2:
		if n % v == 0:
			print(n // v)
			break


from math import log
testcase = int(input())
for t in range(testcase):
	n = int(input())
	t1 = int(log(n + 1, 2))
	for k in range(2, t1 + 1, 1):
		if n % (2 ** k - 1) == 0:
			print(int(n / (2 ** k - 1)))
			break


ins = int(input())
entries = []
for i in range(0, ins):
	entries.append(int(input()))
for i in range(0, ins):
	div = 3
	mult = 2
	while True:
		if (entries[i] / div).is_integer():
			print(int(entries[i] / div))
			break
		else:
			div = div + 2 ** mult
			mult = mult + 1


for i in range(int(input())):
	n = int(input())
	ans = 3
	while n % ans > 0:
		ans = ans * 2 + 1
	print(n // ans)


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
test_count = int(input())
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	N = inp()
	two_power = set()
	curr = 4
	while curr < 1000000000:
		if N % (curr - 1) == 0:
			print(N // (curr - 1))
			break
		curr *= 2


l1 = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, 4294967295, 8589934591, 17179869183, 34359738367]
for _ in range(int(input())):
	n = int(input())
	for i in l1[1:]:
		if n % i == 0:
			print(n // i)
			break


for r in [*open(0)][1:]:
	(n, k) = (int(r), 3)
	while n % k:
		k -= ~k
	print(n // k)


n = int(input())
for j in range(n):
	b = 2
	a = int(input())
	m = a / (2 ** b - 1)
	while m != int(m):
		b = b + 1
		m = a / (2 ** b - 1)
	print(int(m))


a = int(input())
for i in range(a):
	n = int(input())
	for k in range(2, 36):
		z = 2 ** k - 1
		if n % z == 0:
			x = n // z
			break
	print(x)


for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		tmp = 2 ** k - 1
		if n % tmp == 0:
			print(n // tmp)
			break
		k += 1


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def test():
	n = int(input())
	for i in range(1, 30):
		s = 2 ** (i + 1) - 1
		if n % s == 0:
			return n // s
t = int(input())
for _ in range(t):
	print(test())


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	while n % ((1 << k) - 1):
		k += 1
	print(n // ((1 << k) - 1))


t = int(input())
for tt in range(t):
	n = int(input())
	k = 3
	while n % k > 0:
		k = k * 2 + 1
	print(n // k)


t = int(input())
while t:
	n = int(input())
	curr = 4
	while n % (curr - 1) != 0:
		curr *= 2
	ans = int(n / (curr - 1))
	print(ans)
	t -= 1


def main():
	for _ in range(int(input())):
		n = int(input())
		s = 1
		for i in range(n):
			s = s + 2 ** (i + 1)
			if n % s == 0:
				x = n / s
				break
		print(int(x))
main()


for _ in range(int(input())):
	n = int(input())
	k = 2
	while 1:
		a = 2 ** k - 1
		if n % a == 0:
			x = n // a
			break
		k = k + 1
	print(x)


for _ in range(int(input())):
	n = int(input())
	temp = 1
	index = 0
	for i in range(1, n):
		temp += pow(2, i)
		if n % temp == 0:
			print(n // temp)
			break


import math
t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	ans = 1
	flag = 0
	fin = 0
	while 1:
		ans = 2 ** k - 1
		if n % ans == 0:
			flag = 1
			fin = n // ans
			break
		k += 1
	if flag == 1:
		print(fin)
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = 4
	while True:
		if n % (a - 1) == 0:
			print(n // (a - 1))
			break
		a = a * 2


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 3:
		print(1)
		continue
	a = 4
	while True:
		if n % (a - 1) == 0:
			ans = n // (a - 1)
			break
		else:
			a *= 2
	print(ans)


def solution(n):
	for k in range(2, n):
		sol = n / ((1 << k) - 1)
		if int(sol) == sol:
			return int(sol)
	return -1
t = int(input())
for i in range(t):
	print(solution(int(input())))


t = int(input())
for i in range(t):
	n = int(input())
	sumi = 1
	a = 1
	while sumi + pow(2, a) <= n:
		sumi = sumi + pow(2, a)
		if n % sumi == 0:
			break
		a += 1
	print(n // sumi)


for _ in range(int(input())):
	x = int(input())
	for i in range(2, x):
		if x % (2 ** i - 1) == 0:
			print(x // (2 ** i - 1))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	x = 1
	while 2 ** i - 1 < n:
		if n % (2 ** i - 1) == 0:
			x = n // (2 ** i - 1)
			break
		i += 1
	print(x)


import math
arr = []
for i in range(2, int(math.log(10 ** 9, 2)) + 1):
	arr.append(2 ** i - 1)
t = int(input())
for i in range(t):
	n = int(input())
	for i in arr:
		if n % i == 0:
			print(n // i)
			break


def closest(x):
	st = 2
	while True:
		if x % (pow(2, st) - 1) == 0:
			return st
		st += 1
t = int(input())
for _ in range(t):
	n = int(input())
	st = closest(n)
	print(n // (pow(2, st) - 1))


a = int(input())
for i in range(a):
	n = int(input())
	x = 3
	i = 2
	while i < 10000000:
		if n % x == 0:
			if n / x == 1:
				print(1)
				break
			else:
				print(int(n / x))
				break
		else:
			x += 2 ** i
			i += 1


for z in range(int(input())):
	n = int(input())
	count = 0
	for i in range(2, n):
		val = 2 ** i - 1
		if int(n / val) == n / val:
			pos = i
			break
	ans = int(n / val)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		suma = 0
		for i in range(1, k + 1):
			suma += 2 ** (i - 1)
		if n % suma == 0:
			x = n // suma
			break
		k += 1
	print(x)


import sys, os.path
sys.setrecursionlimit(10 ** 5)

def i():
	return sys.stdin.readline().strip()

def ii():
	return int(sys.stdin.readline())

def li():
	return list(sys.stdin.readline().strip())

def mii():
	return map(int, sys.stdin.readline().split())

def lii():
	return list(map(int, sys.stdin.readline().strip().split()))

def solve():
	a = ii()
	for k in range(2, 30):
		if a % (2 ** k - 1) == 0:
			print(int(a / (2 ** k - 1)))
			return False
for _ in range(ii()):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, 32):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


for _ in range(int(input())):
	n = int(input())
	i = 2
	while 1:
		temp = pow(2, i) - 1
		if n % temp == 0:
			x = n // temp
			break
		i += 1
	print(x)


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	n = read_int()
	p = 4
	while n % (p - 1) != 0:
		p *= 2
	return n // (p - 1)
T = read_int()
for _ in range(T):
	print(solve())


import math
t = int(input())
prec = []

def solve(n):
	global prec
	for i in range(len(prec)):
		if n % prec[i] == 0:
			return n // prec[i]
for k in range(2, int(math.ceil(math.log(1000000001, 2)))):
	prec.append(2 ** k - 1)
for _ in range(t):
	n = int(input())
	print(solve(n))


t = int(input())
while t > 0:
	n = int(input())
	(x, s) = (4, 3)
	while n % s != 0:
		s += x
		x *= 2
	print(int(n / s))
	t -= 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	found = False
	for j in range(2, 30):
		a = 2 ** j - 1
		if n % a == 0:
			if found == False:
				print(math.ceil(n / a))
				found = True


def batade(n):
	k = 2
	while True:
		x = n / (2 ** k - 1)
		if x % 1 == 0:
			print(int(x))
			break
		k += 1
t = int(input())
for i in range(t):
	n = int(input())
	ans = batade(n)
	ans


def check(n):
	j = 3
	k = 3
	num = n
	r = n
	flag = 0
	while r >= j:
		if num % j == 0:
			flag = 1
			return j
			break
		j += pow(2, k - 1)
		k += 1
	if flag == 0:
		return 0
t = int(input())
for i in range(t):
	n = int(input())
	val = check(n)
	if val == 0:
		print(n)
	else:
		print(n // val)


import math

def solver(n):
	for i in range(2, n + 1):
		k = int(math.pow(2, i) - 1)
		if n % k == 0:
			return n // k
	return -1
t = int(input())
for i in range(t):
	print(solver(int(input())))


ans = []
sms = [2 ** k - 1 for k in range(2, 30)]
for _ in range(int(input())):
	n = int(input())
	for x in sms:
		if n % x == 0:
			ans.append(int(n / x))
			break
for a in ans:
	print(a)


t = int(input())
while t > 0:
	n = int(input())
	k = 2
	while 1:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		else:
			k += 1
	t -= 1


import math
t = int(input())
while t:
	n = int(input())
	for i in range(2, int(math.log2(n + 1) + 1)):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
	t -= 1


for i in range(int(input())):
	x = int(input())
	st = 3
	last = 2
	ind = 1
	while st <= x:
		if x % st == 0:
			print(x // st)
			break
		ind += 1
		last *= 2
		st += last


t = int(input())
for i in range(t):
	n = int(input())
	a = 1
	for j in range(1, n):
		b = 2 ** j
		a += b
		if n % a == 0:
			break
	print(n // a)


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 1000):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


num = int(input())
for _ in range(num):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		else:
			k += 1


for _ in range(int(input())):
	n = int(input())
	for x in range(2, 10000):
		t = 2 ** x - 1
		if n % t == 0:
			print(n // t)
			break


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	y = 3
	f = False
	while f == False:
		if n % y == 0:
			print(n // y)
			f = True
		y = y * 2 + 1


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(1)
	else:
		p = 3
		i = 1
		while p > 0:
			if n % p == 0:
				print(n // p)
				break
			else:
				i += 1
				p += 2 ** i


help = [1]
for i in range(10 ** 3):
	help.append(2 * help[-1] + 1)
for _ in range(int(input())):
	n = int(input())
	for x in help:
		if x % n == 0 or (n % x == 0 and x != 1):
			if x > n:
				print(x // n)
			else:
				print(n // x)
			break


for _ in range(int(input())):
	n = int(input())
	g = 2
	while n % (pow(2, g) - 1) != 0:
		g += 1
	print(n // (pow(2, g) - 1))


n = input()
x = float(n)
i = 0
while i < x:
	k = 1
	num = input()
	y = float(num)
	f = 3
	i = i + 1
	while f <= y:
		r = y / f - int(y / f)
		if r == 0:
			print(int(y / f))
			f = y + 1
		else:
			k = k + 1
			f = f + pow(2, k)


for _ in range(int(input())):
	n = int(input())
	for i in range(2, 30):
		r = 2 ** i - 1
		if n % r == 0:
			print(int(n / r))
			break


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = 3
	summ = 0
	for u in range(2, 31623):
		if n % a == 0:
			print(n // a)
			break
		a += 2 ** u


for _ in range(int(input())):
	num = int(input())
	multi = 3
	count = 2
	while num % multi != 0:
		multi += 2 ** count
		count += 1
	print(num // multi)


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 31):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


def F(x):
	i = 2
	s = 3
	while x % s != 0:
		s += 2 ** i
		i += 1
	return s
t = int(input())
for i in range(t):
	n = int(input())
	print(int(n / F(n)))


from sys import stdin
tc = int(stdin.readline())
for _ in range(tc):
	n = int(stdin.readline())
	result = 0
	t = 1
	cnt = 2
	while True:
		t += cnt
		if n % t == 0:
			result = n // t
			break
		cnt *= 2
	print(result)


t = int(input())
for k in range(t):
	n = int(input())
	for i in range(2, 30):
		res = 2 ** i - 1
		if n % res == 0:
			print(n // res)
			break


n = int(input())
for i in range(n):
	num = int(input())
	count = 2
	divisor = 3
	while num % divisor != 0:
		divisor += 2 ** count
		count += 1
	print(num // divisor)


a = int(input())
for i in range(a):
	n = int(input())
	k = 2
	while 1:
		if n % (2 ** k - 1) == 0:
			print(int(n / (2 ** k - 1)))
			break
		k = k + 1


from math import pow
n = int(input())
while n != 0:
	a = int(input())
	k = 0
	x = 0
	i = 2
	for i in range(2, a):
		k = pow(2.0, i) - 1
		if a % k == 0:
			print(int(a / k))
			break
	n -= 1


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
dp = dd(int)
dp[1] = 3
for i in range(2, 35):
	dp[i] = dp[i - 1] + pow(2, i)
for _ in range(int(data())):
	n = int(data())
	for i in dp.values():
		if n % i == 0:
			outln(n // i)
			break


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		n = II()
		s = 1
		for k in range(1, 1000000):
			s += 1 << k
			if n % s == 0:
				print(n // s)
				break
main()


for i in range(int(input())):
	n = int(input())
	k = 2
	r = 0
	while 1:
		r = n // (2 ** k - 1)
		if n % (2 ** k - 1) == 0:
			break
		else:
			k += 1
	print(r)


t = int(input())
ltot = []
for j in range(t):
	ltot.append(int(input()))
for n in ltot:
	for k in range(2, 30):
		t1 = 2 ** k - 1
		if t1 > n:
			break
		if n % t1 == 0:
			print(int(n / t1))
			break


import math
test = int(input())
while test:
	res = 1
	query = int(input())
	modulo = 1000000007
	start = 1
	test -= 1
	while start:
		res = res + int(2 ** start)
		start += 1
		res = res % modulo
		result = query / res
		if result - int(result) == 0:
			final_result = result
			break
	print(int(final_result))


def solve():
	n = int(input())
	t = 2
	while True:
		k = 2 ** t - 1
		if n % k == 0:
			return n // k
		t += 1
t = int(input())
for case in range(t):
	print(solve())


for _ in range(int(input())):
	c = 1
	n = int(input())
	for i in range(1, 32):
		c += 2 ** i
		if n // c == n / c:
			print(int(n // c))
			break


n = int(input())
a = []
for i in range(50):
	if i == 0:
		a.append(1)
	else:
		a.append(a[len(a) - 1] + 2 ** i)
for i in range(n):
	x = int(input())
	for i in range(1, len(a)):
		if x % a[i] == 0:
			print(x // a[i])
			break


for i in range(0, int(input())):
	k = int(input())
	for i in range(2, 31):
		val = (1 << i) - 1
		if k % val == 0:
			print(k // val)
			break


for i in range(int(input())):
	n = int(input())
	m = 3
	ppp = 1
	while 1:
		if n % m == 0:
			print(n // m)
			break
		else:
			ppp = ppp + 1
			m = m + 2 ** ppp


from sys import stdin
input = stdin.readline
for t in range(int(input())):
	n = int(input())
	x = 1
	s = 1
	j = 1
	while True:
		if s != 1 and n % s == 0:
			break
		j *= 2
		s = s + j
	x = n // s
	print(x)


from sys import stdin
cases = int(stdin.readline())
for i in range(cases):
	n = int(stdin.readline())
	for k in range(2, 30):
		div = 2 ** k - 1
		if n % div == 0:
			print(n // div)
			break


for s in [*open(0)][1:]:
	n = int(s)
	k = 3
	while n % k:
		k = k * 2 + 1
	print(n // k)


n = int(input())
inp = []
for i in range(0, n):
	inp.append(int(input()))
for i in range(0, n):
	j = 3
	k = 2
	while True:
		if inp[i] % j == 0:
			print(int(inp[i] / j))
			break
		else:
			j += 2 ** k
			k += 1


import sys
readline = sys.stdin.readline
write = sys.stdin.write
for _ in range(int(readline())):
	n = int(readline())
	for k in range(2, 30):
		x = (1 << k) - 1
		if n % x == 0:
			print(n // x)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	k = 4
	var = 3
	while var <= n:
		if n % var == 0:
			print(n // var)
			break
		else:
			var = var + k
			k = k * 2


def largest_prime_factor(n):
	i = 2
	while i * i <= n:
		if n % i != 0:
			i += 1
		else:
			n //= i
	return n
t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(32):
		if n & n + 1 == 0:
			print(1)
			break
	else:
		for i in range(2, 32):
			if n % (2 ** i - 1) == 0:
				print(n // (2 ** i - 1))
				break


k = 1
a = []
while 2 ** k < 10 ** 9:
	k += 1
	a.append(2 ** k - 1)
t = int(input())
for i in range(t):
	p = int(input())
	for j in a:
		if p % j == 0:
			g = p / j
			break
	print(int(g))


for x in range(int(input())):
	n = int(input())
	i = 1
	s = 1
	while 2 ** i < n:
		s += 2 ** i
		if n % s == 0:
			print(n // s)
			break
		i += 1


T = int(input())
for t in range(T):
	N = int(input())
	k = 2
	while 1:
		if N % (pow(2, k) - 1) == 0:
			x = int(N / (pow(2, k) - 1))
			break
		else:
			k = k + 1
	print(x)


n = int(input())
for i in range(n):
	m = int(input())
	x = 1
	k = 2
	while m % (2 ** k - 1) != 0 and k < 30:
		k += 1
	if m % (2 ** k - 1) == 0:
		print(int(m / (2 ** k - 1)))
	else:
		print('No')


t = input()
i = 0
io = []
out = []
while i < int(t):
	io.append(int(input()))
	k = 2
	while k <= 30:
		x = io[-1] / (2 ** k - 1)
		if x == int(x):
			out.append(int(x))
			break
		k = k + 1
	i = i + 1
i = 0
while i < int(t):
	print(out[i])
	i = i + 1


t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	prod = 0
	while prod < n:
		prod = 2 ** k - 1
		if n % prod == 0:
			print(n // prod)
			break
		k += 1


for _ in range(int(input())):
	n = int(input())
	s = 3
	k = 2
	while n % s != 0:
		if s + k * 2 > n:
			break
		else:
			k = k * 2
			s = s + k
	print(n // s)


from sys import stdin, stdout
from math import *
s = [1]
for i in range(1, 32):
	s.append(2 ** i + s[-1])
for __ in range(int(input())):
	n = int(input())
	ans = 1
	for i in range(1, 32):
		if n % s[i] == 0:
			ans = n // s[i]
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	(pot, sumpot, ans) = (1, 0, 0)
	for k in range(30):
		sumpot += pot
		if sumpot > 1 and n // sumpot * sumpot == n:
			ans = n // sumpot
			break
		pot *= 2
	print(ans)


t = int(input())
while t != 0:
	n = int(input())
	i = 2
	while i < 30:
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
		i += 1
	t -= 1


t = int(input())
for _ in range(t):
	s = int(input())
	curr = 1
	cs = 0
	cs += curr
	curr = 2
	while s > cs:
		cs += curr
		if s % cs == 0:
			res = s // cs
			break
		curr = curr * 2
	print(res)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	k = 2
	while 2 ** k - 1 <= n:
		if n % (2 ** k - 1) == 0:
			ans = n // (2 ** k - 1)
			break
		k += 1
	print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	j = 2
	while True:
		temp = pow(2, j) - 1
		if n % temp == 0:
			break
		j += 1
	x = int(n / temp)
	print(x)


for i in range(int(input())):
	n = int(input())
	t = 1
	l1 = [1]
	i = 1
	while t < 1000000000:
		t = 2 ** i
		l1.append(t + l1[i - 1])
		i += 1
	ans = 0
	for i in range(1, len(l1)):
		if n % l1[i] == 0:
			ans = int(n / l1[i])
			break
	print(ans)


t = int(input())
while t != 0:
	t -= 1
	x = int(input())
	a = 3
	while x % a != 0:
		a = (a + 1) * 2 - 1
	print(x // a)


testcase = int(input())
Nums = [int(input()) for _ in range(testcase)]
flag = 1
for n in Nums:
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


t = int(input())
pref = [1]
x = 3
f = 4
while 1000000000.0 >= pref[-1]:
	pref.append(x)
	x += f
	f *= 2
pref = pref[1:]
for i in range(t):
	n = int(input())
	for j in pref:
		if n % j == 0:
			print(n // j)
			break


import sys
ks = []
val = 2
while val < 2000000000.0:
	val *= 2
	ks.append(val - 1)
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	for k in ks:
		(div, mod) = divmod(n, k)
		if mod == 0:
			print(div)
			break


def solve(n):
	k = 2
	cpt = 2 ** k - 1
	while n % cpt != 0:
		k += 1
		cpt = 2 ** k - 1
	x = n // cpt
	return x
T = int(input())
for x in range(T):
	n = int(input())
	y = solve(n)
	print(y)


import sys
power = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
n = int(input())
for i in range(n):
	t = int(input())
	x = 1
	for j in range(len(power)):
		x += 2 ** power[j]
		if t % x == 0:
			print(t // x)
			break


for t in range(int(input())):
	n = int(input())
	b = 3
	i = 3
	while n % b != 0:
		b = 2 ** i - 1
		i += 1
	print(n // b)


tc = int(input())
for eachi in range(tc):
	n = int(input())
	i = 2
	while 1:
		if n % (pow(2, i) - 1) == 0:
			x = n // (pow(2, i) - 1)
			break
		i = i + 1
	print(x)


for z in range(int(input())):
	n = int(input())
	i = 2
	while n % (2 ** i - 1) != 0:
		i += 1
	d = n / (2 ** i - 1)
	print(int(d))


def a(n):
	if n == 1:
		return 1
	k = 2
	while k:
		if n % (2 ** k - 1) == 0:
			return int(n / (2 ** k - 1))
		else:
			k += 1
l = []
s = int(input())
for i in range(s):
	x = int(input())
	l.append(x)
for j in range(s):
	print(a(l[j]))


t = int(input())
for _ in range(t):
	a = int(input())
	total = 0
	i = 2
	while 2 ** i - 1 <= a:
		if a % (2 ** i - 1) == 0:
			print(int(a / (2 ** i - 1)))
			break
		i += 1


from math import *

def main():
	for _ in range(int(input())):
		n = int(input())
		base = 2
		exp = 0
		ans = []
		denom = 1
		while denom <= n:
			if n % denom == 0:
				ans.append(int(n // denom))
			exp += 1
			newd = pow(2, exp)
			denom += int(newd)
		if len(ans) == 1:
			print(ans[0])
		else:
			print(ans[1])
main()


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def generate():
	nums = []
	for k in range(2, 31):
		nums.append(2 ** k - 1)
	return nums

def main():
	t = INT()
	nums = generate()
	while t != 0:
		n = INT()
		for i in nums:
			if n % i == 0:
				final = n // i
				break
		print(final)
		t -= 1
main()


divisors = []
for i in range(2, 30):
	divisor = 2 ** i - 1
	divisors.append(divisor)
t = int(input())
for _ in range(t):
	n = int(input())
	for i in divisors:
		if n % i == 0:
			ans = n // i
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
	else:
		for i in range(2, 31):
			d = pow(2, i) - 1
			if n % d == 0:
				print(n // d)
				break


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = int(math.log2(n))
	if n <= 20:
		b = [3, 7, 11]
		for i in b:
			if n % i == 0:
				print(n // i)
				break
	else:
		for i in range(2, a + 3):
			b = 2 ** i - 1
			if n % b == 0:
				print(n // b)
				break


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
for _ in range(int(f_input())):
	amount = int(f_input())
	(result, power) = (3, 2)
	while amount % result != 0:
		result += pow(2, power)
		power += 1
	f_print(str(amount // result) + '\n')


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 30):
		m = 2 ** k - 1
		if n % m == 0:
			print(n // m)
			break
		else:
			pass


divs = []
n = 1
t = int(input())
two = 2
while n <= 1000000000:
	n += two
	divs.append(n)
	two *= 2

def find_res(n):
	for div in divs:
		if n % div == 0:
			return n // div
for _ in range(t):
	n = int(input())
	print(find_res(n))


t = int(input())
while t > 0:
	n = int(input())
	a = []
	ans = 1
	sum1 = 1
	while True:
		if sum1 > 1000000000:
			break
		ans = ans * 2
		sum1 += ans
		a.append(sum1)
	for i in a:
		if n % i == 0:
			print(n // i)
			break
	t -= 1


def candies():
	lista = []
	numero = int(input())
	for cant in range(0, numero):
		v = input()
		lista.append(int(v))
	k = 2
	divisor = 3
	for n in lista:
		while float(n // divisor) != n / divisor:
			divisor += 2 ** k
			k += 1
		x = n // divisor
		print(x)
		k = 2
		divisor = 3
candies()


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	g = 3
	while 2 ** i - 1 <= n:
		g = 2 ** i - 1
		if n % g == 0:
			break
		i += 1
	print(n // g)


t = int(input())
for each_t in range(t):
	n = int(input())
	l = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647]
	m = 0
	for i in l:
		if n % i == 0:
			m = i
			break
	print(n // m)


MOD = 10 ** 9 + 9

def power(x, n):
	result = 1
	while n:
		if n & 1:
			result = result * x % MOD
		n = int(n / 2)
		x = x * x % MOD
	return result
for i in range(int(input())):
	n = int(input())
	curr = 3
	k = 2
	while True:
		if n % curr == 0:
			print(n // curr)
			break
		curr += power(2, k)
		k += 1


for _ in range(int(input())):
	s = int(input())
	n = 1
	su = 1
	i = 1
	while True:
		n *= 2
		su += n
		i += 1
		if s % su == 0:
			print(int(s / su))
			break


for _ in range(int(input())):
	n = int(input())
	i = 4
	x = 0
	while i - 1 <= n:
		if n % (i - 1) == 0:
			x = n // (i - 1)
			break
		i <<= 1
	print(x)


t = int(input())
while t:
	t -= 1
	n = int(input())
	for k in range(2, n):
		res = 2 ** k - 1
		if n % res == 0:
			print(n // res)
			break


for _ in range(int(input())):
	n = int(input())
	for k in range(2, 30):
		if n % (pow(2, k) - 1) == 0:
			print(n // (pow(2, k) - 1))
			break


def solve():
	n = int(input())
	s = [2 ** i - 1 for i in range(2, 32)]
	for i in s:
		if n % i == 0:
			return n // i
for __ in range(int(input())):
	print(solve())


t = int(input())
l = []
for i in range(2, 31):
	l.append(2 ** i - 1)
for i in range(0, t):
	n = int(input())
	for j in range(0, len(l)):
		if n % l[j] == 0:
			x = n // l[j]
			break
	print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, 401):
		t = pow(2, i)
		p = t - 1
		if n % p == 0:
			print(n // p)
			break


for _ in range(int(input())):
	n = int(input())
	i = 2
	while True:
		if n % (i * 2 - 1) == 0:
			ans = n // (2 * i - 1)
			break
		else:
			i *= 2
	print(ans)


import math
import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	(now, cnt) = (3, 2)
	while n % now:
		now += 1 << cnt
		cnt += 1
	print(n // now)


import sys
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize
sys.setrecursionlimit(10 ** 7)
mod = 1000000007

def IOE():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		i = 1
		while True:
			s = '1' + '1' * i
			if n % int(s, 2) == 0:
				print(n // int(s, 2))
				break
			i += 1
try:
	IOE()
except:
	pass
main()


num = int(input())
for i in range(num):
	n = int(input())
	for k in range(2, n):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


for __ in range(int(input())):
	n = int(input())
	for i in range(2, 30):
		val = (1 << i) - 1
		if n % val == 0:
			print(n // val)
			break


for _ in range(int(input())):
	a = int(input())
	(k, i) = (3, 2)
	while a % k != 0 and k + (1 << i) <= a:
		k += 1 << i
		i += 1
	print(a // k)


t = int(input())
for i in range(t):
	n = int(input())
	i = 3
	while True:
		if n % i == 0:
			x = n // i
			break
		i += 1
		i *= 2
		i -= 1
	print(x)


t = int(input())
i = 0
while i < t:
	n = int(input())
	for x in range(2, 30):
		b = 2 ** x - 1
		if n % b == 0:
			print(n // b)
			break
	i = i + 1


t = int(input())
for _ in range(t):
	n = int(input())
	x = 1
	while True:
		x = x << 1
		x += 1
		if n % x == 0:
			print(n // x)
			break


for _ in range(int(input())):
	n = int(input())
	k = 2
	while k > 1:
		i = n // (2 ** k - 1)
		if i * (2 ** k - 1) == n:
			print(i)
			k = 0
		k += 1


for _ in range(int(input())):
	q = int(input())
	g = q
	s = 0
	for i in range(2, q + 1):
		if 2 ** i - 1 <= q:
			if q % (2 ** i - 1) == 0:
				s = i
				break
	print(q // (2 ** s - 1))


t = int(input())
degs = [2 ** m - 1 for m in range(2, 31)]
for _ in range(t):
	n = int(input())
	x = [n // d for d in degs if n % d == 0]
	assert x
	print(x[0])


t = int(input())
for _ in range(t):
	i = int(input())
	prev = 2
	current = 3
	while i % current != 0:
		prev *= 2
		current += prev
	print(i // current)


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
t_c = ii()
for _ in range(t_c):
	n = ii()
	x = 3
	b = 4
	while n % x:
		x += b
		b += b
	print(n // x)


import sys
t = int(input())
for _ in range(t):
	b = int(input())
	n = bin(b).replace('0b', '')
	n = n.replace('0', '')
	if b == int(n, 2):
		print(1)
	else:
		s = '11'
		while int(s, 2) < b:
			if b % int(s, 2) == 0:
				print(int(b / int(s, 2)))
				break
			s += '1'


for _ in range(int(input())):
	n = int(input())
	x = 0
	k = 0
	for i in range(2, 33):
		g = pow(2, i)
		g -= 1
		if n % g == 0:
			k = i
			x = n // g
			break
	print(x)


t = int(input())
arr = []
nn = 2
for j in range(1, 40):
	nn = nn * 2
	arr.append(nn - 1)
for i in range(t):
	n = int(input())
	for k in arr:
		if n % k == 0:
			print(n // k)
			break


def A():
	n = int(input())
	for i in range(n):
		num = int(input())
		k = 2
		while num % (2 ** k - 1) != 0:
			k = k + 1
		print(int(num / (2 ** k - 1)))
A()


for test in range(int(input())):
	N = int(input())
	x = 0
	for k in range(2, 30):
		if N % (2 ** k - 1) == 0:
			x = N // (2 ** k - 1)
			break
	print(x)


q = int(input())
for i in range(q):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


t = int(input())
while t:
	t -= 1
	x = int(input())
	m = 0.0
	for i in range(2, 31):
		m = x / (pow(2, i) - 1)
		if m == int(m):
			break
	print(int(m))


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 10000000000):
		if n / (2 ** k - 1) == n // (2 ** k - 1):
			print(n // (2 ** k - 1))
			break


import math
for _ in range(int(input())):
	n = int(input())
	for i in range(2, 42):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


tcases = int(input().strip())
powsof2 = [2 ** i - 1 for i in range(2, 33)]
for case in range(tcases):
	n = int(input().strip())
	for p in powsof2:
		if n >= p and n % p == 0:
			print(n // p)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	while True:
		if n % int(pow(2, k) - 1) == 0:
			print(n // int(pow(2, k) - 1))
			break
		k += 1


TEST = int(input())
answers = []
for _ in range(TEST):
	n = int(input())
	a = 3
	k = 2
	while n % a != 0:
		a += 2 ** k
		k += 1
	answers.append(n // a)
for ans in answers:
	print(ans)


divisor_list = [3, 7, 31, 127, 2047, 8191, 131071, 524287, 8388607, 536870911, 2147483647]
test = int(input())
for t in range(test):
	n = int(input())
	for divisor in divisor_list:
		if n % divisor == 0:
			print(n // divisor)
			break


vals = []
for k in range(70):
	vals.append(2 ** k)
for i in range(1, len(vals)):
	vals[i] = vals[i] + vals[i - 1]
vals = vals[1:]
for _ in range(int(input())):
	n = int(input())
	for i in vals:
		if n % i == 0:
			print(n // i)
			break


t = int(input().strip())
pows = [(1 << i) - 1 for i in range(35)]
for it in range(t):
	n = int(input().strip())
	for i in range(2, 35):
		if n % pows[i] == 0:
			print(n // pows[i])
			break


from math import log2
for _ in range(int(input())):
	n = int(input())
	x = 0
	for i in range(2, int(log2(n + 1) + 1)):
		if n % (2 ** i - 1) == 0:
			x = n // (2 ** i - 1)
			break
	print(x)


from sys import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	i = 1
	s = 3
	while 1:
		if n % s == 0:
			break
		i += 1
		s += 2 ** i
	print(n // s)


for _ in range(int(input())):
	n = int(input())
	p = 1
	curr = 1
	while n % (curr + p * 2) != 0:
		p *= 2
		curr += p
	print(n // (curr + p * 2))


import math
cases = int(input())
for _ in range(cases):
	n = int(input())
	limit = int(math.log(n, 2)) + 1
	for k in range(2, limit + 1):
		k1 = 2 ** k - 1
		if n % k1 == 0:
			print(n // k1)
			break


t = int(input())
s = []
for i in range(2, 1001):
	s.append(int(2 ** i) - 1)
while t:
	n = int(input())
	for su in s:
		if n % su == 0:
			print(n // su)
			break
	t -= 1


for _ in range(int(input())):
	n = int(input())
	i = 3
	val = 2 ** (i - 1) - 1
	while n % val != 0:
		i += 1
		val = 2 ** (i - 1) - 1
	print(n // val)


for t in range(int(input())):
	n = int(input())
	from math import log, ceil
	st = ceil(log(n, 2))
	for k in range(2, st + 1):
		p = 2 ** k - 1
		if n % p == 0:
			print(n // p)
			break


T = int(input())
for _ in range(T):
	n = int(input())
	ss = 1
	for k in range(2, n + 1):
		ss += 2 ** (k - 1)
		s = n % ss
		if s == 0:
			x = int(n / ss)
			if type(x) == int:
				print(x)
				break


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	i = 3
	while N % i != 0:
		i = i * 2 + 1
	print(N // i)

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


ppp = int(input())
for tika in range(0, ppp):
	n = int(input())
	for i in range(2, 1000000000):
		if n / (2 ** i - 1) % 1 == 0:
			print(int(n / (2 ** i - 1)))
			break


l = [1, 2]
for i in range(30):
	l.append(l[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	f = True
	for i in range(2, len(l)):
		if n % sum(l[:i]) == 0:
			print(n // sum(l[:i]))
			f = False
			break
	if f:
		print(n)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
from collections import deque
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
t = ni()
for i in range(t):
	n = ni()
	now = 2
	for k in range(1, 33):
		now *= 2
		if n % (now - 1) == 0:
			print(n // (now - 1))
			break


n = int(input())
o = int(0)
for i in range(n):
	l = int(input())
	k = 2
	while o == 0:
		pp = 2 ** k - 1
		if l % pp == 0:
			print(int(l / pp))
			break
		k += 1


import math
for _ in range(int(input())):
	m = int(input())
	n = int(math.log(m, 2))
	for i in range(2, n + 2):
		ans = m / (2 ** i - 1)
		if int(ans) == ans:
			print(int(ans))
			break
		else:
			continue


a = [1]
for i in range(1, 33):
	a.append(a[i - 1] * 2)
sumarr = [1]
for i in range(1, 33):
	sumarr.append(sumarr[i - 1] + a[i])
T = int(input())
for t in range(T):
	n = int(input())
	for i in range(1, 33):
		if n % sumarr[i] == 0:
			print(n // sumarr[i])
			break


import sys
t = int(input())
nums = []
for i in range(t):
	value = int(sys.stdin.readline().strip())
	nums.append(value)

def count(n):
	cur = 0
	index = 0
	while cur + 2 ** index <= n:
		cur += 2 ** index
		if n % cur == 0 and index > 0:
			return n // cur
		index += 1
for i in range(t):
	ans = count(nums[i])
	print(ans)


for i in range(int(input())):
	n = int(input())
	for j in range(2, n + 1):
		if n % (2 ** j - 1) == 0:
			print(n // (2 ** j - 1))
			break


def multipliers(k):
	return sum(map(lambda x: 2 ** x, range(k)))

def check(n):
	k = 2
	while True:
		tmp = multipliers(k)
		a = n // tmp
		b = n / tmp
		if a == b:
			return a
		k += 1
t = int(input())
while t:
	print(check(int(input())))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	i = 2
	while True:
		if n % (pow(2, i) - 1) == 0:
			print(n // (pow(2, i) - 1))
			break
		i += 1


import math
for _ in range(int(input())):
	n = int(input())
	i = 2
	while True:
		x = n / (2 ** i - 1)
		if math.floor(x) == math.ceil(x):
			print(int(x))
			break
		i += 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	for i in range(2, n):
		c1 = math.pow(2, i) - 1
		if n % c1 == 0:
			print(int(n // c1))
			break


test_cases = int(input())
ans = []

def main():
	wr = int(input())
	k = 2
	while wr % (2 ** k - 1):
		k += 1
	num = wr / (2 ** k - 1)
	ans.append(int(num))
for i in range(test_cases):
	main()
for i in ans:
	print(i)


num = int(input())
for i in range(num):
	n = int(input())
	r = 1
	z = 1
	test = 0
	while z <= n:
		if test == 1:
			break
		if n % z == 0 and z > 1:
			print(n // z)
			test += 1
		else:
			r = r * 2
			z = z + r


t = int(input())
for x in range(t):
	n = int(input())
	for y in range(1, n):
		if n % (2 ** (y + 1) - 1) == 0:
			ans = n / (2 ** (y + 1) - 1)
			print(int(ans))
			break


for _ in range(int(input())):
	a = int(input())
	b = 3
	while a % b != 0:
		b = (b + 1) * 2 - 1
	print(int(a // b))


for _ in range(int(input())):
	n = int(input())
	a = 1
	j = 1
	while True:
		a += j * 2
		if n % a == 0:
			b = n // a
			break
		j = j * 2
	print(b)


t = int(input())
for test in range(t):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			break
		k += 1
	print(n // (2 ** k - 1))


import math
t = int(input())
list = []
for n in range(1, t + 1):
	a = input()
	a = int(a)
	k = 2
	while int(a / (2 ** k - 1)) != a / (2 ** k - 1):
		k += 1
	list.append(int(a / (2 ** k - 1)))
for n in list:
	print(n)


import sys
import math
tc = int(input())
for _tc in range(tc):
	val = int(input())
	k = 2
	while k > 1:
		s = (1 - 2 ** (k - 1)) // (1 - 2)
		if s > 1 and val % s == 0:
			print(val // s)
			break
		k += 1


import math
test = int(input())
for tes in range(test):
	n = int(input())
	count = 0
	for k in range(2, math.ceil(math.log2(n))):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			count += 1
			break
	if count == 0:
		print(1)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	x = 3
	k = 2
	if x == n:
		ans.append(1)
	else:
		while n % x != 0:
			x = x + 2 ** k
			k += 1
		a = n / x
		ans.append(int(a))
for i in range(t):
	print(ans[i])


ntc = int(input())
tc = []
for i in range(ntc):
	tc.append(int(input()))
for tc_i in tc:
	n = tc_i
	sum = 3
	k = 2
	while True:
		if n % sum == 0:
			x = n // sum
			print(x)
			break
		else:
			k += 1
			sum += 2 ** (k - 1)


t = int(input())
for i in range(t):
	n = int(input())
	tot = 3
	inc = 2
	while n % tot != 0:
		inc *= 2
		tot += inc
	print(n // tot)


t = int(input())
for _ in range(t):
	n = int(input())
	i = 3
	l = 2
	while n % i != 0:
		l = l * 2
		i += l
	print(int(n / i))


for _ in range(int(input())):
	n = int(input())
	k = 3
	i = 2
	while n % k != 0:
		k = k + pow(2, i)
		i = i + 1
	else:
		print(n // k)


num = int(input())

def test(n):
	for k in range(2, n):
		if n % (pow(2, k) - 1) == 0:
			print(int(n / (pow(2, k) - 1)))
			break
for _ in range(0, num):
	T = input()
	test(int(T))


n = int(input())
array = []
for i in range(n):
	num = int(input())
	array.append(num)

def candies(n):
	if n % 3 == 0:
		return int(n / 3)
	else:
		for i in range(3, 30, 2):
			sum = 2 ** i - 1
			if n % sum == 0:
				return int(n / sum)
for num in array:
	print(candies(num))


def process(n):
	answer = 15.3
	counter = 1
	cur = 1
	while answer % 1 != 0:
		counter += 2 ** cur
		answer = n / counter
		cur += 1
	return answer
t = int(input())
answers = []
for a in range(t):
	n = int(input())
	answers.append(str(int(process(n))))
for b in answers:
	print(b)


l = []
for i in range(2, 40):
	l.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	for i in range(len(l)):
		if n % l[i] == 0:
			print(n // l[i])
			break


table = [4]
for i in range(27):
	table.append(table[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	for i in table:
		if n % (i - 1) == 0:
			print(n // (i - 1))
			break


t = int(input())
for tt in range(t):
	n = int(input())
	k = 2
	while True:
		val = (1 << k) - 1
		if n % val == 0:
			print(n // val)
			break
		k += 1


for _ in range(int(input())):
	sumn = 0
	n = int(input())
	for k in range(0, n):
		sumn += 2 ** k
		if n % sumn == 0 and k > 0:
			print(int(n / sumn))
			break


test = int(input())
for i in range(test):
	n = int(input())
	k = 2
	flag = 1
	while flag == 1:
		if n % (pow(2, k) - 1) == 0:
			flag = 0
		else:
			k += 1
	print(n // (pow(2, k) - 1))


import sys, math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	s = 3
	k = 3
	while n % s != 0:
		s += 2 ** (k - 1)
		k += 1
	print(n // s)


def __starting_point():
	n = int(input())
	for i in range(n):
		n = int(input())
		k = 4
		while True:
			if n % (k - 1) == 0:
				print(n // (k - 1))
				break
			else:
				k *= 2
__starting_point()


def solve(n):
	k = 2
	while True:
		sum = 2 ** k - 1
		x = str(n / sum).split('.')
		if len(x) == 2 and x[1] == '0':
			print(int(x[0]))
			break
		k += 1
t = int(input())
while t != 0:
	n = int(input())
	solve(n)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	den = 3
	p = 2
	while True:
		if n % den == 0:
			print(n // den)
			break
		den += 2 ** p
		p += 1


cfsum = [1, 3]
for i in range(2, 30):
	cfsum.append(2 ** i + cfsum[i - 1])
for t in range(int(input())):
	n = int(input())
	f = 0
	i = 1
	while n >= cfsum[i]:
		if n % cfsum[i] == 0:
			f = 1
			break
		i += 1
	if f == 0:
		print(n)
	else:
		f = 1
		print(int(n / cfsum[i]))


t = int(input())
x = 1
sums = []
for j in range(1, 50):
	coef = [x * 2 ** i for i in range(0, j)]
	if sum(coef) > 10 ** 9:
		break
	sums.append(sum(coef))
sums.pop(0)
for i in range(t):
	n = int(input())
	for e in sums:
		if n % e == 0:
			print(n // e)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	answer = 1
	for i in range(2, n):
		sum_k = (1 << i) - 1
		if n % sum_k == 0:
			answer = n // sum_k
			break
	print(answer)


a = [2 ** i - 1 for i in range(2, 31)]
t = int(input())
b = []
for i in range(t):
	x = int(input())
	count = 0
	while x >= a[count]:
		if x % a[count] == 0:
			b.append(x // a[count])
			break
		count += 1
print(*b, sep='\n')


t = int(input())
while t != 0:
	n = int(input())
	k = 3
	while n % k != 0:
		k = 2 * k + 1
	print(n // k)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	l = 3
	k = 2
	while n % l != 0:
		l += 2 ** k
		k += 1
	print(n // l)


t = int(input())
for i in range(t):
	n = int(input())
	for i in range(2, n):
		x = n / (2 ** i - 1)
		if x == int(x):
			print(int(x))
			break


q = int(input())
for _ in range(q):
	n = int(input())
	for k in range(2, 100):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


from math import sqrt
for __ in range(int(input())):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


output = []
for __ in range(int(input())):
	N = int(input())
	k = 2
	num = 3
	while True:
		if N % num == 0:
			break
		k *= 2
		num += k
	output.append(N // num)
for o in output:
	print(o)


cnt = int(input())
for _ in range(cnt):
	n = int(input())
	k = 2
	curr = 4
	while k:
		c = curr - 1
		if n / c == n // c:
			print(int(n / c))
			break
		curr *= 2
		k += 1


import math

def isPowerOfTwo(x):
	return x and (not x & x - 1)
for _ in range(int(input())):
	n = int(input())
	for i in range(2, 31):
		if n % ((1 << i) - 1) == 0:
			print(n // ((1 << i) - 1))
			break


for _ in range(int(input())):
	(n, i) = (int(input()), 4)
	while n % (i - 1):
		i <<= 1
	print(n // (i - 1))


def solution(n):
	for k in range(2, 50):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)
t = int(input())
for n in range(t):
	print(solution(int(input())))


T = int(input())
while T > 0:
	N = int(input())
	x = -1
	for i in range(2, 40):
		k = (1 << i) - 1
		res = N / k
		if res.is_integer():
			x = int(res)
			break
	print(x)
	T -= 1


t = int(input())
for _ in range(t):
	v = int(input())
	k = 2
	summ = 1
	while 1:
		summ = 2 ** (k - 1) + summ
		if v % summ == 0:
			print(int(v / summ))
			break
		k = k + 1


for z in range(int(input())):
	n = int(input())
	k = 2
	x = 0
	while 1:
		if n % -(1 - 2 ** k) == 0:
			x = n // -(1 - 2 ** k)
			break
		k += 1
	print(x)


for _ in range(int(input())):
	a = int(input())
	l = []
	i = 2
	f = 0
	while 2 ** i - 1 <= a:
		l.append(2 ** i - 1)
		i += 1
	for i in l:
		if a % i == 0:
			f = 1
			print(a // i)
			break
	if f == 0:
		print(1)


t = int(input())
for t1 in range(0, t):
	n = int(input())
	c = 0
	ans = 1
	z = pow(2, 1) - 1
	i = 1
	while 1:
		i = i + 1
		z = pow(2, i) - 1
		if n % z == 0:
			break
	print(n // z)


import math
t = int(input())
for __ in range(t):
	n = int(input())
	y = 3
	while True:
		if n % y == 0:
			print(int(n / y))
			break
		y = 2 * y + 1


from math import sqrt, log
for i in range(int(input())):
	c = int(input())
	k = 1
	for j in range(2, c):
		k += 2 ** (j - 1)
		if c % k == 0:
			print(c // k)
			break


t = int(input())
while t:
	t -= 1
	f = False
	n = int(input())
	for k in range(2, n):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


cases = int(input())
for _ in range(cases):
	number = int(input())
	d = 3
	n = 2
	while number % d != 0:
		n *= 2
		d += n
	print(number // d)


t = int(input())
series = [2 ** k - 1 for k in range(2, 50) if 2 ** k - 1 <= 10 ** 9]
for tt in range(t):
	n = int(input())
	for s in series:
		if n % s == 0:
			print(n // s)
			break


t = int(input())
for q in range(t):
	n = int(input())
	i = 2
	while True:
		if n % (i * 2 - 1) == 0:
			print(n // (i * 2 - 1))
			break
		else:
			i *= 2


e = int(input())
for q in range(e):
	n = int(input())
	a = [3]
	k = 2
	while a[-1] < n:
		a.append(2 ** k - 1)
		k += 1
	for i in a:
		if n % i == 0:
			print(n // i)
			break


t = int(input())

def solve(n):
	for k in range(2, 1000):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)
for i in range(t):
	n = int(input())
	print(solve(n))


for i in range(int(input())):
	n = int(input())
	k = 3
	while True:
		if n % k == 0:
			print(n // k)
			break
		k = 2 * k + 1


t = int(input())
for __ in range(t):
	n = int(input())
	sum1 = 3
	next = 4
	status = False
	x = -1
	while sum1 <= n:
		if n % sum1 == 0:
			status = True
			x = n // sum1
			break
		sum1 += next
		next *= 2
	print(x)


pw = [1]
for i in range(1, 40):
	pw.append(pw[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	i = 2
	sm = 3
	flag = False
	while n % sm != 0:
		sm += pw[i]
		i += 1
		if sm > n:
			flag = True
			break
	if flag:
		ans = 1
	else:
		ans = n // sm
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1)
		continue
	re = 0
	k = 3
	i = 2
	while True:
		if n % k == 0:
			re = n // k
			break
		k += pow(2, i)
		i += 1
	print(re)


t = int(input())
result_list = []
while t > 0:
	n = int(input())
	if n == 3:
		result_list.append(1)
		t -= 1
		continue
	i = 2
	while 2 ** i - 1 <= n:
		if n % (2 ** i - 1) == 0:
			result_list.append(n // (2 ** i - 1))
			break
		i += 1
	t -= 1
for i in result_list:
	print(i)


for _ in range(int(input())):
	n = int(input())
	s = '1'
	for i in range(69):
		s += '1'
		if n % int(s, 2) == 0:
			print(n // int(s, 2))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	a = 3
	while True:
		if n / a == n // a:
			ans = n // a
			break
		a = a * 2 + 1
	print(ans)


t = int(input())
for _ in range(0, t):
	w = int(input())
	i = 2
	while w % (2 ** i - 1) != 0:
		i = i + 1
	print(w // (2 ** i - 1))


def main():
	t = int(input())
	d = {}
	for i in range(t):
		n = int(input())
		for k in range(2, 100):
			r = 2 ** k - 1 if k not in d else d[k]
			d[k] = r
			if n % r == 0:
				print(n // r)
				break
main()


from sys import stdin, stdout

def main():
	arr = [1]
	mod = 10 ** 9
	i = 0
	while arr[i] <= mod:
		res = 2 * arr[i]
		i += 1
		arr.append(res)
	for i in range(1, len(arr)):
		arr[i] = arr[i - 1] + arr[i]
	for _ in range(int(stdin.readline())):
		n = int(input())
		for i in range(1, len(arr)):
			if n % arr[i] == 0:
				print(n // arr[i])
				break
main()


test = int(input())
while test > 0:
	n = int(input())
	k = 1
	while True:
		x = pow(2, k + 1) - 1
		if not n % x == 0:
			k += 1
			continue
		print(int(n / x))
		break
	test = test - 1


t = int(input())
if 1 <= t <= 10 ** 4:
	for i in range(t):
		n = int(input())
		for k in range(2, 31, 1):
			x = n / (2 ** k - 1)
			if x > 1 and n % x == 0 and (x % 2 == 0) or (x - 1) % 2 == 0:
				x = int(x)
				print(x)
				break


t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	ksum = 3
	fl = False
	x = 0
	while ksum <= n and (not fl):
		if n % ksum == 0:
			fl = True
			x = n / ksum
		k += 1
		ksum = ksum + 2 ** (k - 1)
	print(int(x))


n = int(input())
for i in range(n):
	num = int(input())
	k = 3
	add = 4
	while True:
		if num % k == 0:
			print(int(num / k))
			break
		k += add
		add *= 2


from sys import stdin, stdout
read = stdin.readline
write = stdout.write
for _ in range(int(read())):
	n = int(read())
	s = 3
	i = 4
	while s < n:
		if n / s == n // s:
			break
		else:
			s += i
			i *= 2
	write(str(n // s) + '\n')


def main():
	for _ in range(int(input())):
		n = int(input())
		for i in range(2, 10000):
			a = pow(2, i) - 1
			if n % a == 0:
				print(n // a)
				break
main()


import sys
import math
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	for j in range(2, 40):
		if n % (2 ** j - 1) == 0:
			print(n // (2 ** j - 1))
			break


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n):
	k = 2
	ksum = 3
	while n % ksum != 0:
		k += 1
		ksum += pow(2, k - 1)
	return n // ksum
t = read_int()
for case in range(t):
	n = read_int()
	sol = solve(n)
	print(sol)


t = int(input())
for i in range(t):
	n = int(input())
	s = 1
	c = 1
	while c <= n:
		c = c * 2
		s += c
		if n % s == 0:
			print(n // s)
			break


a = []
for k in range(2, 31):
	a.append(2 ** k - 1)
t = int(input())
for _ in range(t):
	m = int(input())
	for d in a:
		if m % d == 0:
			print(m // d)
			break


t = int(input())
for i in range(t):
	n = int(input())
	f = 2
	num = 3
	while n % num != 0:
		f *= 2
		num += f
	print(n // num)


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(2, 30):
		valor = 2 ** j - 1
		if n % valor == 0:
			print(n // valor)
			break


R = lambda : map(int, input().split())
for i in range(int(input())):
	n = int(input())
	for k in range(2, 100):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	p = 2
	while True:
		d = 2 ** p - 1
		if n % d == 0:
			print(n // d)
			break
		p += 1


two_factors = [1]
for i in range(1, 32):
	two_factors.append(two_factors[i - 1] * 2)
T = int(input())
for t in range(T):
	N = int(input())
	idx = 0
	while idx < len(two_factors):
		if two_factors[idx] > N:
			break
		idx += 1
	X = -1
	K = -1
	for i in range(2, idx + 1):
		if (N / (two_factors[i] - 1)).is_integer():
			X = N // (two_factors[i] - 1)
			K = two_factors[i]
			break
	print(X)


t = int(input())
for _ in range(t):
	n = int(input())
	p = 4
	while True:
		if n % (p - 1) == 0:
			print(n // (p - 1))
			break
		p = p << 1


MOD = 10 ** 9 + 7

def main():
	for _ in inputt():
		(n,) = inputi()
		k = 4
		while n % (k - 1):
			k *= 2
		print(n // (k - 1))
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	sys.stdout.write(kwargs.pop('split', ' ').join(map(str, args)))
	sys.stdout.write(kwargs.pop('end', '\n'))
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda : map(int, inputs())
inputl = lambda t=0, k=inputi: map(list, (k() for _ in range(t))) if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError
main()


t = int(input())
import math
for xyz in range(t):
	n = int(input())
	for ab in range(2, math.ceil(math.log(10 ** 9 - 1) / math.log(2))):
		if n % (2 ** ab - 1) == 0:
			print(n // (2 ** ab - 1))
			break


def solve(n):
	i = 2
	while (1 << i) - 1 <= n:
		if n % ((1 << i) - 1) == 0:
			return n // ((1 << i) - 1)
		i = i + 1
	return int(n)
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


for i in range(int(input())):
	n = int(input())
	ok = 0
	for k in range(2, 41):
		temp = (1 << k) - 1
		if n % temp == 0:
			print(n // temp)
			ok = 1
			break


def ans(n):
	q = 2
	while True:
		x = n / (2 ** q - 1)
		if x == int(x):
			return int(x)
		q += 1
w = int(input())
for i in range(w):
	e = int(input())
	print(ans(e))


def x(n):
	k = 0
	tem = 0
	while 1:
		tem = tem + 2 ** k
		if k != 0 and n % tem == 0:
			break
		k += 1
	ks = 0
	for i in range(k + 1):
		ks += 2 ** i
	return n // ks
T = int(input())
for tc in range(1, 1 + T):
	n = int(input())
	print(x(n))


t = int(input())
ans = []
for _ in range(1, t + 1):
	n = int(input())
	s = 1
	p = 1
	while True:
		s = s + 2 ** p
		p = p + 1
		if n % s == 0:
			print(n // s)
			break


t = int(input())
power_of_two = [4]
for i in range(1, 31):
	power_of_two.append(power_of_two[-1] * 2)
for _ in range(t):
	n = int(input())
	for p in power_of_two:
		if n % (p - 1) == 0:
			print(n // (p - 1))
			break


import math
y = []
i = 1
ans = 1
while i < 10 ** 9 + 1 and ans < 10 ** 9 + 1:
	y.append(ans)
	i = i * 2
	ans += i
y.pop(0)
t = int(input())
for i in range(t):
	n = int(input())
	for j in y:
		if n % j == 0:
			print(n // j)
			break


import math
l = []
for i in range(2, 31):
	l.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	for i in range(len(l)):
		if n % l[i] == 0:
			print(n // l[i])
			break


from sys import stdin, stdout
import math
mod = 10 ** 9 + 7
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	for i in range(2, int(math.log(n, 2)) + 2):
		x = n / (2 ** i - 1)
		temp = int(x)
		if x == temp:
			stdout.write(str(temp) + '\n')
			break


for _ in range(int(input())):
	n = int(input())
	m = 3
	k = 2
	while n % m > 0:
		m += 2 ** k
		k += 1
	print(n // m)


import math
t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 100000):
		(frac, whole) = math.modf(n / (math.pow(2, k) - 1))
		if frac == 0 and whole > 0:
			res = n / (math.pow(2, k) - 1)
			print(int(res))
			break


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(30):
		if n % (2 ** (j + 2) - 1) == 0:
			print(int(n / (2 ** (j + 2) - 1)))
			k = j
			break
		pass


for _ in range(int(input())):
	n = int(input())
	j = 1
	i = 2
	s = 0
	while i <= n:
		j += i
		i *= 2
		if n % j == 0:
			print(n // j)
			break


t = int(input())
for k in range(t):
	x = int(input())
	(s, p, n) = (1, 2, 0)
	while s < x:
		s += p
		if x % s == 0:
			n = x // s
			break
		p <<= 1
	print(n)


for _ in ' ' * int(input()):
	a = int(input())
	k = 3
	i = 1
	while a % k:
		i += 1
		k += 2 ** i
	print(a // k)


for _ in range(int(input())):
	n = int(input())
	ch = -1
	k = 2
	while ch == -1:
		num = 2 ** k - 1
		if n % num == 0:
			ch = 0
			x = n // num
		k += 1
	print(x)


for _ in range(int(input())):
	n = nn = int(input())
	a = 3
	i = 2
	while n % a != 0:
		a += 2 ** i
		i += 1
	print(n // a)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, n):
		if n % (2 ** k - 1) == 0:
			print(round(n / (2 ** k - 1)))
			break


t = int(input())
while t > 0:
	n = int(input())
	t -= 1
	x = 0.5
	k = 1
	while x % 1 != 0:
		k += 1
		x = n / (pow(2, k) - 1)
	print(int(x))


t = int(input())
for dsa in range(t):
	n = int(input())
	a = 2
	while 1:
		a = a * 2
		if n % (a - 1) == 0:
			print(int(n / (a - 1)))
			break


import sys
input = sys.stdin.readline

def sum_multi_to_n(a, r, n):
	return (a * pow(r, n) - a) // (r - 1)

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		x = 1
		for i in range(2, 10 ** 6):
			x += pow(2, i - 1)
			if N % x == 0:
				print(N // x)
				break
main()


import math
n = int(input(''))
for i in range(0, n):
	f = int(input(''))
	k = 2
	while True:
		result = 2 ** k - 1
		if int(f % result) != 0:
			k += 1
			continue
		else:
			x = f / (2 ** k - 1)
			print(int(x))
			break


for _ in range(int(input())):
	n = int(input())
	k = 2
	while k >= 2 and k <= 29:
		temp = 2 ** k - 1
		if n % temp == 0:
			print(n // temp)
			break
		k += 1


import math as m

def give(x):
	e = 0
	for i in range(2, x):
		e = m.pow(2, i)
		if x % (e - 1) == 0:
			break
	return int(abs(x / (e - 1)))
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
for item in arr:
	print(give(item))


import sys
from itertools import count

def main():
	(_, *l) = map(int, sys.stdin.read().strip().split())
	out = []
	for i in l:
		for j in count(2):
			if not i % (2 ** j - 1):
				out.append(i // (2 ** j - 1))
				break
	return out
print(*main(), sep='\n')


a = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911]
for _ in range(int(input())):
	n = int(input())
	for i in a:
		if n % i == 0:
			print(n // i)
			break


def solve(n):
	sol = 2
	while sol > 0:
		if n % (2 ** sol - 1) == 0:
			return int(n / (2 ** sol - 1))
		sol += 1
no = int(input())
for i in range(no):
	n = int(input())
	print(solve(n))


t = int(input())
while t != 0:
	n = int(input())
	k = 2
	temp = (1 << k) - 1
	while int(n % temp) != 0:
		k += 1
		temp = (1 << k) - 1
	print(int(n / temp))
	t -= 1


t = int(input())
for z in range(t):
	n = int(input())
	for i in range(2, n):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


t = int(input())
for i in range(0, t):
	n = int(input())
	c = 0
	m = 2
	while c == 0:
		x = n / (2 ** m - 1)
		y = int(x)
		if y == x:
			print(y)
			c = 1
		else:
			m = m + 1


t = int(input())
z = []
for i in range(t):
	z.append(int(input()))
for n in z:
	k = 2
	while k < n:
		x = n / (2 ** k - 1)
		if x - int(x) == 0:
			break
		k += 1
	print(int(x))


t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	while 2 ** k - 1 <= n:
		x = n / (2 ** k - 1)
		if x.is_integer():
			print(int(x))
			break
		k += 1


def solution(n):
	for i in range(2, 33):
		x = pow(2, i) - 1
		if n % x == 0:
			return n // x
t = int(input())
for _ in range(t):
	n = int(input())
	print(solution(n))


import sys
input = sys.stdin.readline

def base(n, b):
	if n == 0:
		return [0]
	digits = []
	while n:
		digits.append(int(n % b))
		n //= b
	return digits[::-1]
for _ in range(int(input())):
	n = int(input())
	curr = '11'
	for i in range(33):
		a = int(curr, 2)
		if n % a == 0:
			print(n // a)
			break
		curr = curr + '1'


t = int(input())
for _ in range(t):
	n = int(input())
	a = 3
	flag = 0
	while flag == 0:
		if n % a == 0:
			print(n // a)
			flag = 1
		else:
			a = a * 2 + 1


import sys
from sys import stdin, stdout
import math
import random
import heapq
from collections import Counter
from functools import lru_cache
try:
	for _ in range(int(input())):
		n = int(input())
		for i in range(2, 30):
			val = (1 << i) - 1
			if n % val == 0:
				print(n // val)
				break
except EOFError as e:
	print(e)


test_case_no = int(input())
for _ in range(test_case_no):
	n = int(input())
	k = 2
	while pow(2, k) - 1 <= n:
		if n % (pow(2, k) - 1) == 0:
			print(int(n / (pow(2, k) - 1)))
			break
		else:
			k += 1


import math
t = int(input())
for i in range(t):
	k = 0
	n = int(input())
	for k in range(2, 10 ** 5):
		d = n / (2 ** k - 1)
		if d == int(d):
			k = d
			break
	print(int(k))


import math
t = int(input())
for i in range(t):
	n = int(input())
	for i in range(2, 10000000000):
		if n % (2 ** i - 1) == 0:
			x = n // (2 ** i - 1)
			print(x)
			break


t = input()
arr = []
for i in range(int(t)):
	arr.append(int(input()))
for j in range(int(t)):
	k = 2
	while arr[j] % (2 ** k - 1) != 0:
		k = k + 1
	print(int(arr[j] / (2 ** k - 1)))


import math

def candies(n):
	k = 2
	while True:
		denominator = math.pow(2, k) - 1
		if n % denominator == 0:
			return int(n / denominator)
		k += 1
t = int(input())
results = []
for i in range(t):
	n = int(input())
	results.append(candies(n))
for result in results:
	print(result)


def res(n):
	k = 2
	x = 0
	while True:
		if n % (2 ** k - 1) == 0:
			break
		k += 1
	print(n // (2 ** k - 1))
n = int(input())
for i in range(n):
	res(int(input()))


for i in range(int(input())):
	n = int(input())
	k = 2
	while 2 ** k - 1 <= n:
		f = n / (2 ** k - 1)
		if str(f)[-2:] == '.0':
			print(int(f))
			break
		k = k + 1


for _ in range(int(input())):
	n = int(input())
	(x, p) = (3, 2)
	while True:
		if n % x == 0:
			break
		p = p * 2
		x += p
	print(n // x)


def intpow(a, n):
	ans = 1
	while n > 0:
		if n & 1:
			ans = ans * a
		a = a * a
		n = n >> 1
	return ans
for _ in range(int(input())):
	n = int(input())
	i = 1
	while True:
		i += 1
		j = intpow(2, i) - 1
		if n % j == 0:
			print(n // j)
			break


t = int(input())
(m, k, s, op, ip) = (0, 0, 0, [], [])
for i in range(t):
	ip.append(int(input()))
while m != t + 1:
	if s > 1 and ip[m] % s == 0:
		op.append(ip[m] // s)
		(s, k) = (0, 0)
		m += 1
	s = s + pow(2, k)
	k += 1
	if m == t:
		break
print(*op, sep='\n')


t = int(input(''))
for i in range(t):
	n = int(input(''))
	k = 2
	while not n % (2 ** k - 1) == 0:
		k += 1
	print(int(n / (2 ** k - 1)))


import math
for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		x = n / (pow(2, k) - 1)
		if math.ceil(x) == math.floor(x):
			print(int(x))
			break
		else:
			k += 1


import math

def candles(n):
	for i in range(2, n // 2 + 2):
		result = n / (2 ** i - 1)
		if math.floor(result) == math.ceil(result):
			break
	return math.floor(result)
	return
t = int(input())
while t:
	n = int(input())
	print(candles(n))
	t -= 1


def countBits(n):
	a = 0
	while n > 0:
		n = n & n - 1
		a += 1
	return a
t = int(input())
for i in range(t):
	n = int(input())
	bits = countBits(n)
	for j in range(2, n):
		s = pow(2, j)
		if n % (s - 1) == 0:
			a = s - 1
			break
	x = int(n / a)
	print(x)


n = int(input())
(k, l) = (2, [])
for i in range(28):
	k *= 2
	l.append(k - 1)
for _ in range(n):
	a = int(input())
	c = 0
	i = 0
	while c == 0:
		if a % l[i] == 0:
			c = a // l[i]
		i += 1
	print(c)


from math import log2
t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, int(log2(n + 1)) + 1):
		m = 2 ** k - 1
		if n % m == 0:
			print(int(n / m))
			break


for i in range(int(input())):
	n = int(input())
	for k in range(2, 34):
		if n % (2 ** k - 1) == 0:
			x = n / (2 ** k - 1)
			print(int(x))
			break


t = int(input())
base = [1]
for _ in range(1, 31):
	base.append(base[_ - 1] * 2)
for _ in range(0, t):
	n = int(input())
	sum = 0
	for i in range(1, 31):
		sum = sum + base[i]
		if n % (sum + 1) == 0:
			print(n // (sum + 1))
			break


for _ in range(int(input())):
	n = int(input())
	arr = [1, 2]
	flag = False
	while not flag:
		if n % sum(arr) != 0:
			x = arr[-1]
			arr.append(x * 2)
		else:
			ans = n // sum(arr)
			flag = True
	print(ans)


from __future__ import division, print_function

def get_ints():
	return map(int, input().strip().split())

def get_array():
	return list(map(int, input().strip().split()))
from math import pow, gcd
from random import randint

def main():
	for _ in range(int(input())):
		n = int(input())
		k = 2
		while k > 1:
			if n % (pow(2, k) - 1) == 0:
				n //= pow(2, k) - 1
				break
			k += 1
		print(int(n))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


T = int(input())
for t in range(T):
	n = int(input())
	for k in range(2, 100):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
	else:
		print('nope')


counter = int(input())
for i in range(counter):
	num = int(input())
	temp = 2
	while temp <= num:
		temp = temp * 2
		x = num / (temp - 1)
		if x.is_integer():
			print(int(x))
			break


t = int(input())
for i in range(t):
	n = int(input())
	x = 2
	s = 3
	while n % s != 0:
		s += 2 ** x
		x += 1
	ans = n // s
	print(ans)


def f(a, b):
	return a // b if a % b == 0 else f(a, b * 2 + 1)
cas = int(input())
for _ in range(cas):
	v = int(input())
	print(f(v, 3))


t = int(input())
while t:
	t -= 1
	n = int(input())
	for i in range(2, 30):
		val = (1 << i) - 1
		if n % val == 0:
			print(n // val)
			break


def f(n):
	k = 2
	while k < 30:
		if n % ((1 << k) - 1) == 0:
			return int(n / ((1 << k) - 1))
		k += 1
t = int(input())
for i in range(t):
	print(f(int(input())))


import math
t = int(input())
while t > 0:
	n = int(input())
	sum = 1
	for k in range(2, n):
		sum = sum + 2 ** (k - 1)
		x = math.modf(n / sum)
		if x[0] == 0.0:
			print(int(x[1]))
			break
	t = t - 1


T = int(input())
for _ in range(T):
	n = int(input())
	p = 4
	while n % (p - 1) != 0:
		p *= 2
	x = int(n / (p - 1))
	print(x)


T = int(input())
from math import floor, ceil
for t in range(1, T + 1):
	n = int(input())
	done = False
	k = 2
	while not done:
		sm = 2 ** k - 1
		result = n / sm
		if ceil(result) == floor(result):
			done = True
		k += 1
	print(int(result))


t = int(input())
while t > 0:
	n = int(input())
	x = 0
	k = 2
	while 1:
		cur = 2 ** k - 1
		if n % cur == 0:
			print(int(n / cur))
			break
		k += 1
	t -= 1


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		x = 0
		k = 2
		while x == 0:
			if n % (pow(2, k) - 1) == 0:
				x = n // (pow(2, k) - 1)
				break
			k += 1
		print(x)
main()


t = int(input())
ans = [0] * t
for j in range(t):
	n = int(input())
	for k in range(2, n + 1):
		if n % (2 ** k - 1) == 0:
			ans[j] = n // (2 ** k - 1)
			break
for i in range(t):
	print(ans[i])


l = []
s = 0
for i in range(32):
	s += pow(2, i)
	l.append(s)
for _ in range(int(input())):
	n = int(input())
	ans = 0
	for i in range(32):
		if n % l[i] == 0 and l[i] != 1:
			ans = l[i]
			break
	print(n // ans)


k = [2, 3, 5, 7, 9, 11]
for i in range(int(input())):
	n = int(input())
	for j in range(2, n + 1):
		x = n / (2 ** j - 1)
		if x.is_integer():
			print(int(x))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	(l, r) = (2, 30)
	for m in range(l, r + 1):
		if n % (pow(2, m) - 1) == 0:
			print(n // (pow(2, m) - 1))
			break


import math
n = int(input())
g = []
for i in list(range(n)):
	p = int(input())
	g.append(p)

def fun(m):
	sum = 1
	for k in list(range(1, 30)):
		sum = sum + 2 ** k
		if g[i] % sum == 0:
			return g[i] / sum
for i in list(range(len(g))):
	e = fun(g[i])
	print(int(e))


t = int(input())
n = 10 ** 9
tw_power = {}
(value, sumi) = [0] * 2
while sumi <= n:
	sumi = 2 ** value
	tw_power[sumi] = 1
	value += 1
for _ in range(t):
	n = int(input())
	temp = 0
	nums = []
	for key in tw_power:
		temp += key
		if temp <= n:
			nums.append(temp)
		else:
			break
	for i in range(1, len(nums)):
		if n % nums[i] == 0:
			print(n // nums[i])
			break


t = int(input())
for i in range(t):
	n = int(input())
	flag = True
	counter = 3
	while flag:
		if n >= counter:
			if n % counter == 0:
				print(n // counter)
				flag = False
			else:
				counter = counter * 2 + 1
		else:
			flag = False


import math

def solve(n):
	x = 0
	div = 1
	for k in range(2, n + 1):
		div += 2 ** (k - 1)
		if n % div == 0:
			x = n // div
			break
	print(x)
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


from collections import defaultdict, deque
import heapq, bisect, math, itertools, string, queue, copy, time
import sys
input = sys.stdin.readline
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)

def inp():
	return int(input())

def inpl():
	return list(map(int, input().split()))

def inpl_str():
	return list(input().split())
t = inp()
for _ in range(t):
	n = inp()
	k = 1
	while True:
		k += 1
		if n % (2 ** k - 1) == 0:
			break
	print(n // (2 ** k - 1))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		res = 0
		tag = 0
		ins = 1
		while True:
			tag += ins
			ins *= 2
			res += 1
			if (tag % n == 0 or n % tag == 0) and res > 1:
				print(n // tag)
				break
main()


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
n = ii()
for _ in range(n):
	t = ii()
	s = 0
	for i in range(32):
		s += pow(2, i)
		if t % s == 0 and i >= 1:
			print(t // s)
			break


T = int(input())
for t in range(T):
	n = int(input())
	for i in range(2, n):
		val = 2 ** i - 1
		if n % val == 0:
			print(n // val)
			break


t = int(input())
i = 0
while i < t:
	n = int(input())
	k = 2
	x = n / (2 ** k - 1)
	while x % 1 != 0:
		k += 1
		x = n / (2 ** k - 1)
	if x == 0:
		x = n
	print(str(int(x)))
	i += 1


t = int(input())
for i in range(t):
	n = int(input())
	add = 3
	k = 2
	while add <= n:
		if n % add == 0:
			print(n // add)
			break
		add += 2 ** k
		k += 1


for __ in range(int(input())):
	n = int(input())
	s = 3
	nxt = 4
	x = -1
	while s <= n:
		if n % s == 0:
			x = n // s
			break
		s += nxt
		nxt *= 2
	print(x)


import math
for w in range(int(input())):
	x = int(input())
	cont = 3
	while True:
		if x % cont == 0:
			print(int(x / cont))
			break
		cont += cont + 1


t = int(input())
powers = [2 ** i - 1 for i in range(2, 32)]
while t > 0:
	t -= 1
	n = int(input())
	for j in powers:
		if n % j == 0:
			print(n // j)
			break


def main():
	t = int(input())
	for turn in range(t):
		n = int(input())
		k = 2
		x = 1
		l = True
		while l:
			x += k
			if n % x == 0:
				print(n // x)
				l = False
			else:
				k *= 2
	return 0
main()


import math
loop_time = int(input())
for time in range(0, loop_time):
	n = int(input())
	k_max = math.floor(math.log2(n)) + 1
	for k in range(2, k_max + 1):
		x = n / (2 ** k - 1)
		if x.is_integer():
			print(int(x))
			break


pows = {2: 3, 3: 7, 4: 15, 5: 31, 6: 63, 7: 127, 8: 255, 9: 511, 10: 1023, 11: 2047, 12: 4095, 13: 8191, 14: 16383, 15: 32767, 16: 65535, 17: 131071, 18: 262143, 19: 524287, 20: 1048575, 21: 2097151, 22: 4194303, 23: 8388607, 24: 16777215, 25: 33554431, 26: 67108863, 27: 134217727, 28: 268435455, 29: 536870911}
T = int(input())
for _ in range(T):
	n = int(input())
	for (i, s) in pows.items():
		if n % s == 0:
			print(n // s)
			break


tests = int(input())
for i in range(tests):
	n = int(input())
	k = 2
	multiplier = 1
	while multiplier <= n:
		multiplier = 2 ** k - 1
		if n % multiplier == 0:
			print(n // multiplier)
			break
		else:
			k += 1


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	k = 2
	while n % (2 ** k - 1):
		k += 1
	print(n // (2 ** k - 1))
for _ in range(int(input())):
	case()


for _ in range(int(input())):
	n = int(input())
	temp = 3
	temp1 = 8
	while n % temp != 0:
		temp = temp1 - 1
		temp1 *= 2
	print(n // temp)


for _ in range(int(input())):
	wrappers = int(input())
	for i in range(2, 64):
		mult = (1 << i) - 1
		if wrappers % mult == 0:
			print(wrappers // mult)
			break


t = int(input())
for test in range(t):
	n = int(input())
	for i in range(2, 30):
		delta = 2 ** i - 1
		if n // delta == n / delta:
			print(n // delta)
			break


t = int(input())
for ii in range(t):
	n = int(input())
	a = 2
	while n % (pow(2, a) - 1) != 0:
		a += 1
	print(n // (pow(2, a) - 1))


t = int(input())
for j in range(t):
	n = int(input())
	i = 0
	sum = 1
	while not (n % sum == 0 and sum != 1):
		if i != 0:
			sum += 2 ** i
		i += 1
	print(n // sum)


def solve(x):
	while 1:
		y = 2 * x
		yield y
		x = y
num = int(input())
for _ in range(num):
	n = int(input())
	a = solve(1)
	sum_ = 1
	while sum_ < n:
		val = next(a)
		sum_ += val
		if n % sum_ == 0:
			print(int(n / sum_))
			break


from sys import stdin

def solve(n):
	sm = 3
	p = 2
	while True:
		if n % sm == 0:
			print(n // sm)
			break
		p <<= 1
		sm += p
	return

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		solve(n)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	power = 1
	sm = 1
	while n % (sm + 2 ** power) != 0:
		sm += 2 ** power
		power += 1
	print(n // (sm + 2 ** power))


t = int(input())
for _ in range(t):
	n = int(input())
	c = 1
	k = 1
	while True:
		a = 2 ** k
		c += a
		if n % c == 0:
			s = n // c
			break
		k += 1
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	res = 4
	while res - 1 <= n:
		if n % (res - 1) == 0 and n // (res - 1) >= 1:
			print(n // (res - 1))
			break
		res *= 2
		k += 1


t = int(input())
ns = [int(input()) for i in range(t)]
for n in ns:
	divisor = 1
	for k in range(2, 10000000):
		divisor += 2 ** (k - 1)
		if n % divisor == 0:
			print(int(n / divisor))
			break


def solve(n):
	result = set()
	x = 0
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			x = n / (2 ** k - 1)
			return x

def main():
	result = []
	t = int(input())
	for i in range(t):
		result.append(solve(int(input())))
	for r in result:
		print(int(r))
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = 3
	for i in range(2, n if n > 10 ** 5 else n):
		if n % s == 0:
			print(n // s)
			break
		s += 2 ** i


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	while n % (2 ** i - 1) != 0 and i <= 32:
		i += 1
	print(n // (2 ** i - 1))


import sys
readline = sys.stdin.readline
writeline = sys.stdout.write
t = int(readline())
pow_2 = [2 ** i for i in range(2, 31)]
for _ in range(t):
	n = int(readline())
	for p in pow_2:
		if n % (p - 1) == 0:
			x = int(n / (p - 1))
			writeline(f'{x}\n')
			break


test_cases = int(input())
in_puts = []
for i in range(test_cases):
	j = int(input())
	in_puts.append(j)
pows = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647]
for n in in_puts:
	for j in pows:
		if n >= j:
			if n % j == 0:
				print(n // j)
				break


import math
t = int(input())
while t:
	x = int(input())
	x = bin(x)
	x = x[2:]
	y = '1'
	for i in range(len(x) - 1):
		y += '1'
		if math.modf(int(x, 2) / int(y, 2))[0] == 0.0:
			print(int(int(x, 2) / int(y, 2)))
			break
	t -= 1


import math
n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
for n in arr:
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


t = int(input())
for z in range(t):
	n = int(input())
	for i in range(2, 64):
		d = pow(2, i) - 1
		if n % d == 0:
			print(n // d)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	candy = 0
	k = 1
	m = 1
	result = 0
	while True:
		m += 2 ** k
		if n % m == 0:
			result = n // m
			break
		k += 1
	print(result)


t = int(input())
for m in range(t):
	n = int(input())
	i = 2
	flag = 0
	while 2 ** i - 1 <= n:
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			flag = 1
			break
		i += 1
	if flag == 0:
		print(n)


t = int(input())
output = []
for _ in range(t):
	a = int(input())
	n = 2
	while not float(a / (2 ** n - 1)).is_integer():
		n += 1
	output.append(int(a / (2 ** n - 1)))
for o in output:
	print(o)


t = int(input())
while t:
	n = int(input())
	p = 4
	k = 2
	while n >= p:
		if n % (p - 1) == 0:
			break
		p *= 2
		k += 1
	print(n // (p - 1))
	t -= 1


for t in range(int(input())):
	n = int(input())
	c = True
	x = 1
	g = 0
	while c:
		g += 1
		x += 2 ** g
		if n % x == 0:
			c = False
	print(n // x)


t = int(input())
while t:
	n = int(input())
	k = 2
	while True:
		l1 = n / (2 ** k - 1)
		l2 = n // (2 ** k - 1)
		if l1 == l2:
			print(l2)
			break
		k += 1
	t -= 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	b = int(math.log2(n))
	c = 0
	for j in range(2, b + 1):
		a = 2 ** j - 1
		if n % a == 0:
			print(int(n / a))
			c = 1
			break
	if c == 0:
		print('1')


import math
for _ in range(int(input())):
	n = int(input())
	i = 2
	x = 1
	while 2 ** i - 1 <= n:
		m = 2 ** i - 1
		if n % m == 0:
			x = n // m
			break
		i += 1
	print(x)


def solve():
	x = int(input())
	for i in range(2, x):
		if x % (2 ** i - 1) == 0:
			print(x // (2 ** i - 1))
			break
n = int(input())
for i in range(n):
	solve()


import sys
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		s = '11'
		while n % int(s, 2) != 0:
			s += '1'
		ans += str(n // int(s, 2)) + '\n'
	print(ans)
a()


import math
for _ in range(int(input())):
	n = int(input())
	for k in range(2, n):
		x = n / (2 ** k - 1)
		if x == int(x):
			print(int(x))
			break


import array
arr = array.array('l', [])
arr.append(1)
arr.append(2)
k = 2
aa = 1
for j in range(1, 29, 1):
	aa = int(k * 2)
	arr.append(aa)
	k = aa
y = input()
n = int(y)
for i in range(0, n, 1):
	x = input()
	a = int(x)
	bb = 1
	for j in range(1, 30, 1):
		bb = bb + arr[j]
		if a % bb == 0:
			p = int(a / bb)
		if a % bb == 0:
			break
	print(p)


def solve():
	n = int(input())
	for k in range(2, 30):
		d = pow(2, k) - 1
		if n % d == 0:
			print(n // d)
			return
t = int(input())
for _ in range(t):
	solve()


n = int(input())
tc = []
for i in range(n):
	inp = int(input())
	tc.append(inp)
sol = []
for i in tc:
	sum = 3
	for s in range(i):
		if i % sum == 0:
			sol.append(i // sum)
			break
		sum = sum + 2 ** (s + 2)
for s in sol:
	print(s)


d = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823]
n = int(input())
for i in range(n):
	k = int(input())
	i = 0
	while k % d[i] != 0:
		i += 1
	print(int(k / d[i]))


for _ in range(int(input())):
	n = int(input())
	temp = 0
	n1 = n
	for k in range(0, n):
		temp += 2 ** k
		if (n / temp).is_integer() and k > 0:
			print(int(n / temp))
			break


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	k = 1
	ksum = 2 ** (k + 1) - 1
	while True:
		ksum = 2 ** (k + 1) - 1
		if n % ksum == 0:
			print(n // ksum)
			break
		k += 1


cases = int(input())
for i in range(0, cases):
	x = int(input())
	j = 3
	for j in range(2, 30):
		t = 2 ** j - 1
		if x % t == 0:
			res = int(x / t)
			print(res)
			break


def findx(n):
	k = 2
	comp = 2 ** k - 1
	while comp <= n:
		comp = 2 ** k - 1
		if n % comp == 0:
			return n // comp
		k += 1
t = int(input())
while t > 0:
	n = int(input())
	print(findx(n))
	t -= 1


t = int(input())
for k in range(t):
	n = int(input())
	d = 3
	i = 4
	while d <= n:
		if n % d == 0:
			x = n / d
			break
		else:
			d = d + i
			i = i * 2
	print(int(x))


t = int(input())
b = []
for i in range(2, 50):
	k = 2 ** i - 1
	b.append(k)
for _ in range(t):
	n = int(input())
	for i in b:
		if n % i == 0:
			print(n // i)
			break


for ii in range(int(input())):
	n = int(input())
	k = 2
	while True:
		if n % (pow(2, k) - 1) == 0:
			print(n // (pow(2, k) - 1))
			break
		else:
			k += 1


test = int(input())
for t in range(test):
	n = int(input())
	for k in range(2, 30):
		temp = 2 ** k - 1
		if n % temp == 0:
			print(n // temp)
			break


test_run = int(input(''))
for test in range(test_run):
	num = int(input(''))
	for i in range(2, 30):
		n = 2 ** i - 1
		if num % n == 0:
			print(int(num / n))
			break


n = int(input())
for i in range(n):
	c = int(input())
	k = 2
	d = 2 ** k - 1
	while c % d > 0:
		d += 2 ** k
		k += 1
	print(c // d)


for _ in range(int(input())):
	n = int(input())
	for k in range(2, 33):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = 2
	while n % (2 ** x - 1) != 0:
		x = x + 1
	print(int(n / (2 ** x - 1)))


times = int(input())
ans = []
for i in range(times):
	num = int(input())
	div = 3
	for k in range(100):
		if num % div == 0:
			ans.append(num / div)
			break
		else:
			div = div * 2 + 1
for i in ans:
	print(int(i))


for i in range(int(input())):
	l = []
	n = int(input())
	l = [1]
	k = 2
	t = 1
	while True:
		l.append(k)
		t += 1
		if n % sum(l) == 0:
			print(int(n // sum(l)))
			break
		k = pow(2, t)


rw = int(input())
for ewqr in range(rw):
	n = int(input())
	for k in range(2, 100000):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


data = [2 ** x - 1 for x in range(2, 1000)]

def solve():
	n = int(input())
	for i in range(998):
		if n % data[i] == 0:
			print(n // data[i])
			return
for _ in range(int(input())):
	solve()


t = int(input())
for u in range(t):
	n = int(input())
	deff = 0
	for i in range(2, 32):
		if n % (2 ** i - 1) == 0 and deff == 0:
			print(n // (2 ** i - 1))
			deff = 1


ans = [3]
k = 2
while ans[-1] + k * 2 < 10 ** 9:
	k *= 2
	ans.append(ans[-1] + k)
for t in range(int(input())):
	n = int(input())
	for i in ans:
		if n % i == 0:
			print(n // i)
			break


for _ in range(int(input())):
	n = int(input())
	cnt = 0
	i = 2
	num = 2 * 2 - 1
	while n % num:
		i += 1
		num = pow(2, i) - 1
	cnt += n // num
	print(cnt)


t = int(input())
while t:
	t = t - 1
	r = int(input())
	k = 2
	while r % (2 ** k - 1):
		k += 1
	print(r // (2 ** k - 1))


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	sys.stderr = open('error.txt', 'w')
t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	sum = 3
	while n % sum:
		sum += k * 2
		k *= 2
	x = n // sum
	print(x)


def main():
	t = int(input().strip())
	for _ in range(t):
		n = int(input().strip())
		i = 4
		while n % (i - 1) != 0:
			i *= 2
		print(n // (i - 1))
main()


import math
l = [3, 7, 21, 73, 273, 1057, 4161, 16513, 65793, 262657, 1049601, 4196353, 16781313, 67117057, 268451841, 1073774593]
for _ in range(int(input())):
	x = int(input())
	i = 2
	while x % (pow(2, i) - 1) != 0:
		i += 1
	print(x // (pow(2, i) - 1))


t = int(input())
l = []
for i in range(t):
	n = int(input())
	s = 3
	j = 4
	while n % s != 0:
		s += j
		j *= 2
	l.append(n // s)
for i in l:
	print(i)


from sys import stdin

def input():
	return stdin.readline()
for _ in range(int(input())):
	num = int(input())
	if num == 1:
		print(1)
	else:
		k = 3
		re = 0
		i = 2
		while True:
			if num % k == 0:
				re = num // k
				break
			k += pow(2, i)
			i += 1
		print(re)


t = int(input())
for x in range(t):
	n = int(input())
	for k in range(3, 31):
		if n % (2 ** (k - 1) - 1) == 0:
			print(int(n / (2 ** (k - 1) - 1)))
			break


for x1 in range(int(input())):
	n = int(input())
	for x in range(2, n + 1):
		if n % (2 ** x - 1) == 0:
			print(n // (2 ** x - 1))
			break


t = int(input())
for i in range(t):
	n = int(input())
	somma = 1
	k = 1
	while True:
		k += 1
		somma += 2 ** (k - 1)
		res = n / somma
		if res.is_integer() == True:
			break
	print(int(res))


for _ in range(int(input())):
	n = int(input())
	i = 4
	for j in range(n):
		if n // (i - 1) * (i - 1) == n:
			print(n // (i - 1))
			break
		i *= 2


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def calc(x):
	j = 1
	for i in range(2, x + 1):
		j = j + pow(2, i - 1)
		if x % j == 0:
			print(int(x / j))
			break
for i in a:
	calc(i)


arr = []
tot = 1
for i in range(1, 31):
	temp = pow(2, i)
	tot += temp
	arr.append(tot)
for _ in range(int(input())):
	n = int(input())
	for i in range(n):
		if n % arr[i] == 0:
			print(n // arr[i])
			break


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 30):
		s = 2 ** k - 1
		if n % s == 0:
			x = n // s
			break
	print(x)


for _ in range(int(input())):
	n = int(input())
	p = 4
	while 1:
		if n % (p - 1) == 0:
			print(n // (p - 1))
			break
		p *= 2


import sys
t = int(input())
for i in range(t):
	a = int(input())
	for j in range(2, sys.maxsize):
		p = 2 ** j - 1
		if a % p == 0:
			print(a // p)
			break


import math
for i in range(int(input())):
	num = int(input())
	l = int(math.log(num + 1) / math.log(2))
	for k in range(2, l + 1):
		ans = num / (math.pow(2, k) - 1)
		if ans == int(ans):
			print(int(ans))
			break


def findX(N, k):
	if N % (pow(2, k) - 1) == 0:
		return N // (pow(2, k) - 1)
	else:
		return None
T = int(input())
for _ in range(T):
	N = int(input())
	flag = False
	for k in range(2, N + 1):
		x = findX(N, k)
		if x != None and x > 0:
			print(x)
			break


t = int(input())
for i in range(t):
	s = 0
	b = int(input())
	for j in range(1000000):
		s = s + 2 ** j
		if b % s == 0 and j != 0:
			print(b // s)
			s = 0
			break


t = int(input())
i = 0
while i < t:
	n = int(input())
	k = 2
	while k < 32:
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			print(x)
			k = 300
		k += 1
	i += 1


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 10 ** 9):
		a = 2 ** k - 1
		if n % a == 0:
			print(n // a)
			break


import sys
try:
	sys.stdin = open(sys.path[0] + '\\input.txt', 'r')
	sys.stdout = open(sys.path[0] + '\\output.txt', 'w')
except FileNotFoundError:
	pass
for tc in range(int(input())):
	n = int(input())
	x = 3
	while x <= n:
		if n % x == 0:
			print(n // x)
			break
		x = x * 2 + 1


def task(n):
	k = 1
	exp = 1
	for i in range(1, 100):
		exp *= 2
		k += exp
		if n % k == 0:
			print(int(n / k))
			break
t = int(input())
for i in range(0, t):
	n = int(input())
	task(n)


n = int(input())
for i in range(n):
	k = 2
	a = int(input())
	x = a // (2 ** k - 1)
	while a % (2 ** k - 1) != 0:
		k += 1
	print(a // (2 ** k - 1))


def solve(n):
	k = 2
	x = -1
	found = False
	while not found:
		power2 = (1 << k) - 1
		x = n // power2
		if n % x == 0:
			found = True
		k += 1
	return x
t = int(input())
for _ in range(t):
	n = int(input())
	ans = solve(n)
	print(ans)


for i in range(int(input())):
	n = int(input())
	a = 0
	for i in range(10 ** 10):
		a += 2 ** i
		if n % a == 0 and i > 0:
			print(n // a)
			break


t = int(input())
for i in range(t):
	n = int(input())
	pw = 1
	for k in range(2, 30):
		val = (1 << k) - 1
		if n % val == 0:
			print(n // val)
			break
		else:
			continue


n = int(input())
for i in range(n):
	a = int(input())
	for j in range(2, a):
		b = a / (pow(2, j) - 1)
		if b.is_integer():
			print(int(b))
			break


t = int(input())
for j in range(t):
	n = int(input())
	a = 4
	while a - 1 <= n:
		if n % (a - 1) == 0:
			print(n // (a - 1))
			break
		else:
			a *= 2


t = int(input())
while t > 0:
	n = int(input())
	y = 4
	for i in range(n):
		if n % (y - 1) == 0:
			print(n // (y - 1))
			break
		y *= 2
	t -= 1


n = int(input())
for i in range(n):
	t = int(input())
	q = 3
	w = 4
	while t % q != 0:
		q += w
		w *= 2
	print(t // q)


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, n):
		y = n / (2 ** k - 1)
		if y % 1 == 0:
			break
		else:
			k += 1
	print(int(y))


t = int(input())
for i in range(t):
	n = int(input())
	d = 2
	while True:
		if n % (2 ** d - 1) == 0:
			print(n // (2 ** d - 1))
			break
		d += 1


from math import log
t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	z = log(n + 1, 2)
	while n % (2 ** k - 1):
		k += 1
		if k >= z:
			break
	print(int(n / (2 ** k - 1)))


import math

def main():
	for q in range(int(input())):
		A = int(input())
		p = 2
		while A % (2 ** p - 1) != 0:
			p += 1
		print(A // (2 ** p - 1))
main()


a = int(input())
for i in range(a):
	n = int(input())
	for k in range(2, 100000000000):
		x = n / (pow(2, k) - 1)
		if x % 1 == 0:
			print(int(x))
			break


t = int(input())
answer = []
nums = []
for i in range(t):
	n = int(input())
	nums.append(n)
for n in nums:
	hidden = 3
	cnt = 2
	x = 0
	while True:
		if n % hidden == 0 and n % 2 == n / hidden % 2:
			x = int(n / hidden)
			break
		hidden += 2 ** cnt
		cnt += 1
	answer.append(x)
for a in answer:
	print(a)


t = int(input())

def solution(n):
	div = 3
	pow = 1
	while n % div != 0:
		pow += 1
		div += 2 ** pow
	return int(n / div)
for i in range(t):
	n = int(input())
	print(solution(n))


import math

def main():
	for _ in range(int(input())):
		n = int(input())
		for i in range(2, n):
			if n // (2 ** i - 1) == n / (2 ** i - 1):
				print(n // (2 ** i - 1))
				break
main()


def main():
	t = int(input())
	ans = []
	for c in range(t):
		n = int(input())
		ans.append(solve(n))
	for a in ans:
		print(a)

def solve(n):
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	x = n // (2 ** k - 1)
	return x
main()


def solve(n):
	x = 4
	while x - 1 <= n // 2:
		if n % (x - 1) == 0:
			return n // (x - 1)
		x = x * 2
	return 1
for t in range(int(input())):
	n = int(input())
	print(solve(n))


pows = [0] * 30
pows[0] = 1
for i in range(1, 30):
	pows[i] = pows[i - 1] * 2
n = int(input())
for i in range(n):
	dato = int(input())
	for j in range(2, dato):
		if dato % (pows[j] - 1) == 0:
			print(int(dato / (pows[j] - 1)))
			break


import math
t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	while True:
		p = 2 ** k
		if n % (p - 1) == 0:
			print(math.trunc(n / (p - 1)))
			break
		k = k + 1


for _ in range(int(input())):
	x = int(input())
	a = 3
	while x % a != 0:
		a = (a << 1) + 1
	print(int(x / a))


t = int(input())
for _ in range(t):
	n = int(input())
	for j in range(2, 10 ** 9):
		if n % (2 ** j - 1) == 0:
			print(n // (2 ** j - 1))
			break


def f(k):
	return 1 + 2 * (k * (k - 1) // 2)
for _ in range(int(input())):
	n = int(input())
	k = 4
	while n % (k - 1) != 0:
		k = k * 2
	print(n // (k - 1))


t = int(input())
x = 1
l1 = []
while x <= t:
	y = int(input())
	l1.append(y)
	x += 1
x = 0
l2 = []
while x < len(l1):
	k = 2
	p2 = l1[x]
	while True:
		p1 = 2 ** k
		p1 -= 1
		if p2 % p1 == 0:
			l2.append(p2 / p1)
			break
		k += 1
	x += 1
x = 0
while x < len(l2):
	print(int(l2[x]))
	x += 1


import math
for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3)
	else:
		k = 2
		while k <= n:
			y = n / (pow(2, k) - 1)
			if math.ceil(y) == math.floor(y):
				print(math.floor(y))
				break
			k += 1


for i in range(int(input())):
	n = int(input())
	a = 2
	xs = 3
	while n % xs != 0:
		a *= 2
		xs += a
	print(n // xs)


import math
T = int(input())
for _ in range(T):
	n = int(input())
	for k in range(2, math.ceil(math.log2(n + 1)) + 1):
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			break
	print(x)


for i in range(int(input())):
	n = int(input())
	for k in range(2, 10 ** 9):
		y = 2 ** k - 1
		x = n / y
		if x == int(x):
			print(int(x))
			break


t = int(input())
for i in range(t):
	n = int(input())
	cur = 1
	sum = 1
	while True:
		cur *= 2
		sum += cur
		if n % sum == 0:
			print(int(n / sum))
			break


for _ in range(int(input())):
	n = int(input())
	for k in range(2, n):
		p = pow(2, k) - 1
		if n % p == 0:
			x = n / p
			break
	print(int(x))


def RA():
	l = input().split()
	return [int(s) for s in l]

def solve():
	n = int(input())
	s = 1
	p = 2
	while True:
		s += p
		if n % s == 0:
			print(n // s)
			return
		p *= 2
t = int(input())
for i in range(t):
	solve()


l = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455]
for _ in range(int(input())):
	n = int(input())
	i = 2
	while True:
		val = 2 ** i - 1
		if n % val == 0:
			print(n // val)
			break
		i += 1


for _ in range(int(input())):
	N = int(input())
	K = 2
	while N % (2 ** K - 1) != 0:
		K = K + 1
	print(N // (2 ** K - 1))


t = int(input())
for i in range(t):
	n = int(input())
	stop = n // 2
	sum_two = 1
	for j in range(stop):
		sum_two = 2 ** (j + 1) + sum_two
		if n % sum_two == 0:
			print(n // sum_two)
			break


def raf(n):
	i = 0
	sum = 0
	while True:
		sum = sum + 2 ** i
		if n % sum == 0 and sum != 1:
			break
		i += 1
	return int(n / sum)
t = int(input())
for _ in range(t):
	print(raf(int(input())))


for _ in range(int(input())):
	n = int(input())
	for i in range(2, n):
		x = n / (2 ** i - 1)
		x1 = n // (2 ** i - 1)
		if x == x1:
			print(int(x1))
			break


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().split()]

def st():
	return input()

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input()]

def li3():
	return [int(i) for i in input()]
for _ in range(val()):
	n = val()
	pro = curr = 1
	for i in range(2, 500):
		pro *= 2
		curr += pro
		if not n % curr:
			print(n // curr)
			break


def read_nums():
	return [int(x) for x in input().split()]

def main():
	for _ in range(int(input())):
		(n,) = read_nums()
		for k in range(2, 31):
			if n % (2 ** k - 1) == 0:
				print(n // (2 ** k - 1))
				break
main()


import math
t = int(input())
result = []
for _ in range(t):
	n = int(input())
	step = 2
	while n % (2 ** step - 1):
		step += 1
	x = int(n / (2 ** step - 1))
	result.append(x)
for res in result:
	print(res)


def problemA(n):
	a = 3
	c = 2
	while n % a != 0:
		b = 2 ** c
		a += b
		c += 1
	return int(n / a)
test = int(input())
for i in range(test):
	n = int(input())
	print(problemA(n))


t = int(input())
p = 0
while p < t:
	n = int(input())
	array = []
	j = 0
	i = 0
	a = 0
	while j < n:
		i += a
		a = 2 ** j
		if i <= n:
			array.append(i + a)
			j += 1
		else:
			break
	array.pop(-1)
	i = 1
	while i < len(array):
		j = i
		if n % array[j] == 0:
			break
		i += 1
	print(n // array[j])
	p += 1


for _ in range(int(input())):
	a = int(input())
	s = 1
	t = 2
	for i in range(a):
		s += t
		t = t * 2
		if a % s == 0:
			print(a // s)
			break


import sys
input = sys.stdin.buffer.readline
import math

def p(k):
	return math.pow(2, k) - 1

def lund():
	n = int(input())
	if n == 3:
		return 1
	else:
		k = 2
		while k:
			l = p(k)
			if n % l == 0:
				break
			else:
				k += 1
		return int(n // l)
t = int(input())
while t:
	t -= 1
	print(lund())


for i in range(int(input())):
	n = int(input())
	for k in range(2, 10000000000000000000000000):
		u = 2 ** k - 1
		if n // u == n / u:
			print(n // u)
			break


c = int(input())
for _ in range(c):
	n = int(input())
	two = 3
	k = 1
	while n % two != 0:
		k += 1
		two += pow(2, k)
	print(n // two)


powers = []
for i in range(2, 30):
	powers.append(pow(2, i) - 1)
T = int(input())
for _ in range(T):
	n = int(input())
	for p in powers:
		if n % p == 0:
			print(n // p)
			break


import math
p = int(input())
for z in range(p):
	n = int(input())
	s = 3
	k = 2
	b = False
	while not b:
		x = n / s
		if x.is_integer():
			print(int(x))
			b = True
		else:
			s += k * 2
			k = k * 2


viuu = []
ans = 1
for i in range(1, 30):
	ans += 2 ** i
	viuu.append(ans)
m = int(input())
for i in range(m):
	n = int(input())
	for j in range(29):
		if n % viuu[j] == 0:
			print(n // viuu[j])
			break


for _ in range(int(input())):
	(n, k) = (int(input()), 4)
	while k <= n + 1:
		if n % (k - 1) == 0:
			print(n // (k - 1))
			break
		else:
			k <<= 1


tc = int(input())
t = 0
while t < tc:
	n = int(input())
	m = 3
	while n % m != 0:
		m = m * 2 + 1
	k = int(n / m)
	t += 1
	print(k)


t = int(input())
dic = {}
n = 10000000000
(i, temp) = [0] * 2
while temp <= n:
	temp = 2 ** i
	dic[temp] = 1
	i += 1
for _ in range(t):
	n = int(input())
	temp = 0
	arr = []
	for key in dic:
		temp += key
		if temp <= n:
			arr.append(temp)
		else:
			break
	for i in range(1, len(arr)):
		if n % arr[i] == 0:
			print(n // arr[i])
			break


for _ in range(int(input())):
	n = int(input())
	found = False
	k = 3
	add = 2
	while found == False:
		if n % k == 0:
			print(n // k)
			found = True
		else:
			add = add * 2
			k = k + add


l = [3]
a = 3
for i in range(2, 31):
	a = a + 2 ** i
	l.append(a)
t = int(input())
while t:
	q = int(input())
	for i in l:
		if q % i == 0:
			r = q // i
			break
	print(r)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	potencia = 2
	while n % (2 ** potencia - 1) != 0:
		potencia += 1
	print(int(n / (2 ** potencia - 1)))


t = int(input())
for i in range(t):
	num = int(input())
	for k in range(2, 30):
		if num % (pow(2, k) - 1) == 0:
			print(num // (pow(2, k) - 1))
			break


t = int(input())
while t > 0:
	n = int(input())
	p = 2
	while True:
		ans = pow(2, p) - 1
		if n % ans == 0:
			print(n // ans)
			break
		p = p + 1
	t = t - 1


n = int(input())
for i in range(n):
	t = int(input())
	for j in range(2, 45):
		q = 2 ** j - 1
		if t % q == 0:
			print(t // q)
			break


import math
t = int(input())
for test in range(t):
	n = int(input())
	k = 2
	s = 3
	while True:
		if n % s == 0:
			print(n // s)
			break
		k *= 2
		s += k


import sys
from collections import defaultdict as dd
import math

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	n = int(data())
	k = 2
	while k:
		a = 2 ** k - 1
		if n % a == 0:
			break
		else:
			k += 1
	print(n // a)


total = int(input())
for i in range(total):
	n = int(input())
	k = 1
	coefficient = 3
	while n % coefficient != 0:
		k += 1
		coefficient += 2 ** k
	print(n // coefficient)


def compute(n):
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	return n // (2 ** k - 1)
t = int(input())
for _ in range(t):
	n = int(input())
	print(compute(n))


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		i = 1
		k = 1
		while 2 ** i - 1 <= n:
			if 2 ** (i + 1) - 1 > n:
				break
			i += 1
			if n % (2 ** i - 1) == 0:
				k = i
				break
		print(n // (2 ** k - 1))
main()


st = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, 4294967295, 8589934591]
t = int(input())
for q in range(t):
	n = int(input())
	i = 0
	while n % st[i] != 0:
		i += 1
	print(n // st[i])


from sys import stdin
debug = False

def join(_s, _l):
	return _s.join(map(str, _l))

def read(_f=None):
	if _f == None:
		return stdin.readline().strip()
	return _f(stdin.readline().strip())

def readlist(_f=None):
	_l = stdin.readline().strip().split()
	if _f == None:
		return _l
	return map(_f, _l)
readint = lambda : read(int)
readints = lambda : readlist(int)
printval = lambda _r: print(_r, end=' ')
printline = lambda _s, _r: print(join(_s, _r), end='\n')

def solve():
	n = readint()
	s = 3
	k = 3
	while n % s != 0:
		s += 2 ** (k - 1)
		k += 1
	return n // s
t = readint()
for _ in range(t):
	if debug:
		print('-' * 20)
	if debug:
		print('ANS: ', end='')
	ans = solve()
	print(ans)


import math
n = int(input())
for i in range(1, n + 1):
	p = int(input())
	j = 2
	while p >= 2 ** j - 1:
		if p % (2 ** j - 1) == 0:
			print(p // (2 ** j - 1))
			break
		else:
			j = j + 1


t = int(input())

def main():
	n = int(input())
	i = 2
	while 1:
		candidate = 2 ** i - 1
		cand_x = n / candidate
		if cand_x == int(cand_x):
			return int(cand_x)
		i += 1
for _ in range(t):
	print(main())


import math
for i in range(int(input())):
	n = int(input())
	for j in range(3, 40):
		e = n / (2 ** (j - 1) - 1)
		if math.floor(e) == math.ceil(e):
			print(int(e))
			break


t = int(input())
for i in range(t):
	n = int(input())
	k = 3
	j = 2
	if n == 1:
		print(1)
	else:
		while n % k != 0:
			k += 2 ** j
			j += 1
		print(n // k)


t = int(input())
case = []
for i in range(t):
	x = input().split()
	case.append(x)
f = False
k = 1
for i in range(t):
	s = True
	l = 3
	a = 0
	k = 1
	for j in range(100):
		if s == True:
			if int(case[i][0]) % l == 0:
				a = int(int(case[i][0]) / l)
				print(a)
				s = False
			else:
				k = k + 1
				l = l + 2 ** k


t = int(input())
for _ in range(t):
	n = int(input())
	x = 3
	i = 2
	while n % x != 0:
		x += 2 ** i
		i += 1
	print(n // x)


NumberOfTestcases = int(input())
for i in range(NumberOfTestcases):
	n = int(input())
	divisor = 3
	while True:
		if n % divisor == 0:
			x = n // divisor
			print(x)
			break
		else:
			divisor = divisor * 2 + 1


a = [2 ** k - 1 for k in range(2, 31)]
t = int(input())
for tc in range(t):
	n = int(input())
	flag = False
	for ele in a:
		if n % ele == 0:
			ans = n // ele
			flag = True
			break
	print(ans)


t = int(input())
for _ in range(t):
	s = int(input())
	for i in range(2, 30):
		su = 2 ** i - 1
		if s % su == 0:
			print(s // su)
			break


num_cases = int(input())
for _ in range(num_cases):
	num = int(input())
	k = 2
	sum = 3
	while sum <= num:
		if num % sum == 0:
			print(int(num / sum))
			break
		else:
			sum += pow(2, k)
			k += 1


t = int(input())
m = 0
a = []
for i in range(t):
	a.append(int(input()))
	if m < a[i]:
		m = a[i]
k = []
k.append(4)
i = 0
while k[i] < m:
	k.append(k[i] * 2)
	i += 1
n = len(k)
for i in range(n):
	k[i] -= 1
for i in a:
	for j in k:
		if i % j == 0:
			print(i // j)
			break


import math

def solve(n):
	k = 2
	while k < math.log(n) / math.log(2) + 1:
		n_0 = 2 ** k - 1
		if n % n_0 == 0:
			return n // n_0
		k += 1
t = int(input())
for i in range(t):
	n = int(input())
	k = solve(n)
	print(k)


import math
x = []
t = int(input())
for _ in range(t):
	n = int(input())
	b = int(math.log2(n)) + 1
	for i in range(2, b + 1):
		k = 2 ** i - 1
		if n % k == 0:
			x.append(n / k)
			break
for a in x:
	print(int(a))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


import math

def main(n):
	for k in range(2, 36):
		den = math.pow(2, k) - 1
		if n % den == 0:
			return int(n / den)
			break
t = int(input())
lst = {}
for i in range(0, t):
	z = int(input())
	lst[i] = z
for y in range(0, t):
	print(main(lst[y]))


for t in range(int(input())):
	number = int(input())
	sex = 3
	i = 2
	while True:
		if number % sex == 0:
			print(number // sex)
			break
		else:
			sex = sex + 2 ** i
			i = i + 1


t = int(input())
z = 0
while z < t:
	n = int(input())
	for k in range(2, 30):
		c = n % (2 ** k - 1)
		if c == 0:
			e = n / (2 ** k - 1)
			print(int(e))
			break
	z += 1


for _ in range(int(input())):
	n = int(input())
	i = 1
	tot = 1
	Ans = 0
	while True:
		tot += 2 ** i
		if n % tot == 0:
			Ans = n // tot
			break
		i += 1
	print(Ans)


from math import ceil as mc, floor as mf, log as l

def isint(n):
	if mc(n) == mf(n):
		return True
	else:
		return False
for _ in range(int(input())):
	n = int(input())
	x = mc(l(n, 2))
	for i in range(2, x + 1):
		y = n / (pow(2, i) - 1)
		if isint(y):
			print(int(y))
			break


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		n = iin()
		j = 3
		p = 4
		while n % j != 0:
			j += p
			p *= 2
		print(n // j)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


i = 1
l = []
a = 0
while a <= 10 ** 9:
	a += 2 ** (i - 1)
	l.append(a)
	i += 1
for _ in range(int(input())):
	n = int(input())
	for i in l[1:]:
		if n % i == 0:
			print(int(n / i))
			break


testcase = int(input())
respostas = []
for each in range(testcase):
	n = int(input())
	for k in range(2, n + 2):
		x = n / (2 ** k - 1)
		if n % (2 ** k - 1) == 0:
			respostas.append(x)
			break
for i in respostas:
	print(int(i))


for i in range(int(input())):
	n = int(input())
	t = 3
	c = 4
	while n % t:
		t += c
		c += c
	print(n // t)


t = int(input())
for i in range(t):
	k = int(input())
	a = 3
	if k % a == 0:
		print(int(k / a))
	else:
		while k % a != 0:
			a = a * 2 + 1
		print(int(k / a))


t = int(input())
while t != 0:
	a = int(input())
	b = 3
	while True:
		if a % b == 0:
			print(a // b)
			break
		else:
			b = b * 2 + 1
	t = t - 1


from sys import stdin, stdout

def solution(n):
	(total, step) = (1, 1)
	while total / 2 <= n:
		step *= 2
		total = total + step
		if n % total == 0:
			return n // total
testcases = int(stdin.readline())
for testcase in range(testcases):
	n = int(stdin.readline().split()[0])
	answer = solution(n)
	stdout.write(str(answer) + '\n')


for _ in range(int(input())):
	n = int(input())
	aa = 2
	for i in range(2, 100):
		aa = aa * 2
		if n % (aa - 1) == 0:
			print(n // (aa - 1))
			break


t = int(input())
for i in range(t):
	x = int(input())
	k = 3
	for j in range(2, 40):
		if x % k == 0:
			print(x // k)
			break
		else:
			k += 2 ** j


import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	n = int(input())
	temp = 1
	k = 1
	while True:
		temp += pow(2, k)
		k += 1
		if n % temp == 0:
			print(n // temp)
			break


import math
from collections import Counter
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	n = I()
	for i in range(2, n):
		x = pow(2, i) - 1
		if n % x == 0:
			print(n // x)
			break


import sys
import math

def check(x):
	while x > 0:
		if x % 2 == 0:
			return False
		x //= 2
	return True

def solve(x):
	tmp = x
	i = 1
	while i * i <= x:
		if x % i == 0:
			if check(i) and i > 1:
				return tmp // i
			if i != x // i:
				if check(x // i):
					return tmp // (x // i)
		i += 1
T = int(sys.stdin.readline())
ans_arr = []
for i in range(T):
	n = int(sys.stdin.readline())
	ans_arr.append(str(solve(n)))
print('\n'.join(ans_arr))


n = int(input())
for i in range(n):
	r = int(input())
	x = -1
	k = 2
	while x == -1:
		if r // (2 ** k - 1) == r / (2 ** k - 1):
			x = r / (2 ** k - 1)
		k += 1
	print(int(x))


t = int(input())
for i in range(t):
	n = int(input())
	j = 4
	while n % (j - 1) != 0:
		j *= 2
	print(n // (j - 1))


T = int(input())
for i in range(T):
	N = int(input())
	k = 3
	increase = 2
	x = 0
	while k <= N:
		if N % k == 0:
			x = N / k
			break
		increase = increase * 2
		k += increase
	print(int(x))


n = int(input())
test = list()
for i in range(n):
	test.append(int(input()))
ks = list()
i = 2
oldsum = 1
while oldsum < 1000000000.0:
	newsum = oldsum + 2 ** (i - 1)
	ks.append(newsum)
	oldsum = newsum
	i += 1
for i in range(n):
	for j in ks:
		if test[i] % j == 0:
			print(test[i] // j)
			break


for _ in range(int(input())):
	n = int(input())
	res = 0
	for i in range(2, 30):
		potential = (1 << i) - 1
		if n % potential == 0:
			print(n // potential)
			break


import math
t = int(input())
for ig in range(t):
	n = int(input())
	k = 2
	while 1:
		x = n / (2 ** k - 1)
		if math.floor(x) == x:
			print(int(x))
			break
		k += 1


def function(n):
	sumk = 3
	i = 2
	while n % sumk != 0:
		sumk += 2 ** i
		i += 1
	print(int(n / sumk))
t = int(input())
for i in range(t):
	n = int(input())
	function(n)


for _ in range(int(input())):
	n = int(input())
	cur = 4
	while True:
		if n % (cur - 1) == 0:
			print(n // (cur - 1))
			break
		else:
			cur *= 2


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = []
	p = 1
	c = 1
	while c <= n:
		a.append(c)
		c = c + p * 2
		p = p * 2
	k = len(a)
	i = 1
	while k > 1:
		if n % a[i] == 0:
			print(n // a[i])
			break
		i = i + 1
		k = k - 1


t = int(input())
while t:
	n = int(input())
	k = 2
	while True:
		x = n / (2 ** k - 1)
		if int(x) == x:
			print(int(x))
			break
		k += 1
	t -= 1


T = int(input())

def main():
	n = int(input())
	for i in range(2, 32):
		if n % (2 ** i - 1) == 0:
			return int(n / (2 ** i - 1))
for _ in range(T):
	print(main())


poww = []
for i in range(2, 33):
	poww.append(pow(2, i) - 1)
t = int(input())
for _ in range(0, t):
	n = int(input())
	for x in poww:
		if n % x == 0:
			print(n // x)
			break


for _ in range(int(input())):
	x = int(input())
	y = 3
	n = 2
	while x % y != 0:
		z = 2 ** n
		y += z
		n += 1
	print(x // y)


T = int(input())
for t in range(T):
	N = int(input())
	k = 2
	while N % (2 ** k - 1) != 0:
		k += 1
	print(N // (2 ** k - 1))


import time
import math
t = int(input())
for q in range(t):
	n = int(input())
	k = 2
	t = time.time()
	while True:
		x = n / (2 ** k - 1)
		if x.is_integer():
			break
		else:
			k += 1
	print(int(x))


import math
t = int(input())
while t > 0:
	n = int(input())
	k = 2
	po = 4
	while True:
		if n % (po - 1) == 0:
			print(n // (po - 1))
			break
		po *= 2
	t -= 1


import random, math
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right

def pop(n):
	if n <= 0:
		return False
	else:
		return n & n - 1 == 0

def solution(n):
	s = 4
	while True:
		if n % (s - 1) == 0:
			return n // (s - 1)
		s *= 2
	return -1

def input_test():
	for _ in range(int(input())):
		n = int(input())
		out = solution(n)
		print(out)

def test():
	pass
input_test()


kl = int(input())
for l in range(kl):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


from collections import defaultdict
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = 3
	i = 2
	while n % s != 0:
		s += pow(2, i)
		i += 1
	print(n // s)


T = int(input())
for _ in range(1, T + 1):
	d = 1
	n = int(input())
	for i in range(1, n):
		d += 2 ** i
		if n % d == 0:
			print(n // d)
			break


def ans(n):
	k = 2
	while True:
		if n % (2 ** k - 1) is 0:
			return n // (2 ** k - 1)
		k += 1
	pass
t = int(input())
for i in range(t):
	x = int(input())
	print(ans(x))


t = int(input())
for i in range(t):
	s = int(input())
	r = 2
	k = 2
	a = s / (2 ** k - 1)
	while a != int(a):
		k += 1
		a = s / (2 ** k - 1)
	print(int(a))


import math
t = int(input())
for tt in range(t):
	n = int(input())
	ans = -1
	for i in range(2, 101):
		temp = (1 << i) - 1
		if n % temp == 0:
			x = n // temp
			ans = x
			break
	print(ans)


for _ in range(int(input())):
	a = int(input())
	i = 2
	z = 2 ** i - 1
	while a % z != 0:
		i += 1
		z = 2 ** i - 1
	print(int(a / (2 ** i - 1)))


t = int(input())
for i in range(t):
	n = int(input())
	K = 1
	while True:
		K += 1
		X = n / (2 ** K - 1)
		if X % 1 == 0 and X >= 1:
			print(int(X))
			break


import sys
import math
input = sys.stdin.buffer.readline

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
for i in range(int(input())):
	n = int(input())
	for i in range(2, 1000):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


for _ in range(int(input())):
	n = int(input())
	po2 = 1
	while True:
		x = 2 ** (po2 + 1) - 1
		po2 += 1
		if n % x == 0:
			print(n // x)
			break


no = int(input())
res = []
for i in range(no):
	m = int(input())
	for j in range(2, 30):
		if m % (2 ** j - 1) == 0:
			res.append(m // (2 ** j - 1))
			break
for i in res:
	print(i)


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	for i in range(2, 10 ** 9 + 1):
		if n / (2 ** i - 1) == int(n / (2 ** i - 1)):
			print(int(n / (2 ** i - 1)))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(3, 99):
		if n % (2 ** (k - 1) - 1) == 0:
			print(n // (2 ** (k - 1) - 1))
			break


def solve():
	T = int(input())
	for t in range(T):
		arr = []
		c = 1
		for i in range(1, 31):
			c += 2 ** i
			arr.append(c)
		n = int(input())
		for p in arr:
			if n % p == 0:
				print(n // p)
				break
solve()


t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	for k in range(2, n + 1):
		if 2 ** k - 1 <= n:
			if n % (2 ** k - 1) == 0:
				x = n // (2 ** k - 1)
				count += 1
				if count == 1:
					print(x)
		else:
			break


def findX(n):
	k = 2
	while 42:
		x = n / (2 ** k - 1)
		if x.is_integer():
			return int(x)
		else:
			k += 1
q = int(input())
for i in range(q):
	j = int(input())
	print(findX(j))


def f(n):
	j = 1
	while j > 0:
		if n % (2 ** (j + 1) - 1) != 0:
			j += 1
		else:
			break
	print(n // (2 ** (j + 1) - 1))
t = int(input())
for i in range(t):
	n = int(input())
	f(n)


t = int(input())
N = []
for i in range(t):
	N.append(int(input()))

def gen_sum():
	num = 3
	k = 2
	while True:
		k += 1
		yield num
		num += 2 ** (k - 1)
for n in N:
	for i in gen_sum():
		if n % i == 0:
			print(int(n / i))
			break


x = int(input())
for a in range(x):
	y = int(input())
	n = 4
	k = 3
	while y % k != 0:
		k += n
		n = int(n * 2)
	print(y // k)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	i = 2
	while True:
		l = 2 ** i - 1
		if n % l == 0:
			print(n // l)
			break
		if l > n:
			print(n)
			break
		i += 1


testCases = int(input())
for _ in range(testCases):
	n = int(input())
	constant = 3
	while True:
		answer = n / constant
		if answer % 1 == 0:
			print(int(answer))
			break
		else:
			constant += constant + 1


for _ in range(int(input())):
	N = int(input())
	i = 2
	while i < 30:
		if not N % (2 ** i - 1):
			print(N // (2 ** i - 1))
			break
		i += 1


import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	n = int(input())
	for k in range(2, 31):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


def run(n):
	x = 1.0
	k = 2.0
	while x * (2 ** k - 1) != n:
		x = float(n / (2 ** k - 1))
		if x.is_integer():
			break
		k += 1
	print(int(x))
i = int(input())
for _ in range(i):
	n = int(input())
	run(n)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	ans = 1
	i = 1
	flag = 1
	while n % ans != 0 or flag == 1:
		ans = ans + 2 ** i
		i += 1
		flag = 0
	print(n // ans)


def f(n):
	for j in a:
		if n % j == 0:
			return n // j
a = []
v = 3
for i in range(100):
	a.append(v)
	v = 2 * v + 1
n = int(input())
for i in range(n):
	print(f(int(input())))


for _ in range(int(input())):
	x = int(input())
	su = 4
	while 1:
		if x % (su - 1) == 0:
			print(x // (su - 1))
			break
		su += su


for _ in range(int(input())):
	n = int(input())
	c = 0
	for i in range(2, 33):
		c = 2 ** i
		c -= 1
		if n % c == 0:
			print(n // c)
			break


import sys
t = int(input())

def wrappies(n):
	strt = 3
	count = 1
	while n % strt != 0:
		count += 1
		strt += 2 ** count
	print(int(n / strt))
for _ in range(t):
	n = int(input())
	wrappies(n)


for _ in range(int(input())):
	n = int(input())
	sum = 1
	p = 2
	while True:
		sum += p
		p *= 2
		if n % sum == 0:
			break
	print(n // sum)


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	t = sint()
	while t:
		t -= 1
		n = sint()
		k = 1
		tw = 1
		while True:
			tw *= 2
			k += tw
			if n % k == 0:
				print(n // k)
				break
main()


t = int(input())
array = []
for test in range(t):
	n = int(input())
	for k in range(2, 1000):
		j = 2 ** k - 1
		if n // j == n / j:
			array.append(n / j)
			break
for item in array:
	print(int(item))


def powersum(k):
	return 2 ** k - 1

def divisor(n):
	k = 2
	while powersum(k) <= n:
		if n % powersum(k) == 0:
			return n / powersum(k)
		else:
			k += 1
	return 0
num = int(input())
for i in range(num):
	n = int(input())
	x = divisor(n)
	print(int(x))


t = int(input())
while t > 0:
	n = int(input())
	i = 1
	while 1:
		s = 2 ** i - 1
		if n % s == 0 and i != 1:
			print(n // s)
			break
		else:
			i = i + 1
	t = t - 1


def solve(n):
	r = 2
	for i in range(1, 32):
		r *= 2
		if n % (r - 1) == 0:
			print(n // (r - 1))
			return 0
n = int(input())
while n > 0:
	n -= 1
	solve(int(input()))


t = int(input())
answers = []
for f in range(t):
	n = int(input())
	for k in range(2, int(100000000.0)):
		p = 2 ** k - 1
		if n % p == 0:
			answers.append(int(n / p))
			break
for answer in answers:
	print(answer)


t = int(input())
for ti in range(t):
	n = int(input())
	s = 3
	i = 2
	while n % s != 0:
		s += 2 ** i
		i += 1
	print(n // s)


s = set()
b = i = 1
while i < 10 ** 9:
	i *= 2
	b += i
	s.add(b)
for n in map(int, [*open(0)][1:]):
	for i in s:
		if n % i < 1:
			print(n // i)
			break


number_test = int(input())
for k in range(number_test):
	n = int(input())
	k = 1
	possible = n % (2 ** (k + 1) - 1)
	while possible != 0:
		k += 1
		possible = n % (2 ** (k + 1) - 1)
	sol = n // (2 ** (k + 1) - 1)
	print(sol)


for u in range(int(input())):
	n = int(input())
	for i in range(2, 33):
		x = n / (2 ** i - 1)
		if x == int(x):
			ka = int(x)
			break
	print(ka)


p = [2 ** i - 1 for i in range(2, 33)]
t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	for i in range(len(p)):
		if p[i] <= n and n % p[i] == 0:
			print(int(n / p[i]))
			break


import sys
t = int(input())
while t:
	n = int(sys.stdin.readline())
	x = 1
	i = 2
	while True:
		x = x + i
		if n % x == 0:
			print(n // x)
			break
		i *= 2
	t -= 1


import math
testcases = int(input())
for i in range(testcases):
	vaulen = int(input())
	for j1 in range(2, vaulen):
		x1 = vaulen / (math.pow(2, j1) - 1)
		x2 = vaulen // (math.pow(2, j1) - 1)
		if x1 == x2:
			print(int(x1))
			break
			pass
		pass
	pass


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

def I():
	return int(input())

def In():
	return map(int, input().split())

def main():
	try:
		(d, j) = ([1], 1)
		for i in range(100):
			j = j << 1
			d.append(d[-1] + j)
		d.pop(0)
		for _ in range(I()):
			n = I()
			for x in d:
				if n % x == 0:
					print(n // x)
					break
	except:
		pass
M = 998244353
P = 1000000007
main()


t = int(input())
for _ in range(t):
	n = int(input())
	for c in range(2, 999999):
		if n % (2 ** c - 1) == 0:
			print(n // (2 ** c - 1))
			break


for xyz in range(0, int(input())):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


import math
test_case = int(input())
for i in range(test_case):
	num = int(input())
	for k in range(2, 32):
		z = 2 ** k - 1
		if num % z == 0 and num >= z:
			print(int(num / z))
			break


def testCase(n):
	multi = 4
	div = 3
	while n % div != 0:
		div += multi
		multi *= 2
	return n // div

def main():
	t = int(input())
	while t > 0:
		n = int(input())
		print(testCase(n))
		t -= 1
main()


q = int(input())
for qq in range(q):
	n = int(input())
	a = 2
	for i in range(2, 50):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	m = 3
	k = 4
	while n % m != 0:
		m += k
		k *= 2
	print(n // m)


from sys import stdin
import math
inp = stdin.readline
t = int(inp().strip())
while t:
	t -= 1
	n = int(inp().strip())
	ans = 0
	i = 2
	while ans == 0:
		if n % (2 ** i - 1) == 0:
			ans = n // (2 ** i - 1)
		i += 1
	print(ans)


import sys
testcases = int(sys.stdin.readline())
for i in range(testcases):
	a = int(sys.stdin.readline())
	s = 3
	i = 2
	while a % s is not 0:
		s += 2 ** i
		i += 1
	print(int(a / s))


cases = int(input())
for case in range(cases):
	value = int(input())
	factor = 3
	while value / factor % 1 != 0:
		factor = factor * 2 + 1
	print(int(value / factor))


def solve():
	n = int(input())
	s = 1
	t = 2
	for _ in range(40):
		s += t
		if n % s == 0:
			return n // s
		t *= 2

def main():
	for _ in range(int(input())):
		print(solve())
main()


t = int(input())
b = []
for i in range(t):
	n = int(input())
	for k in range(2, 1000000000):
		chis = 2 ** k - 1
		if n % chis == 0:
			x = n / chis
			break
	b.append(x)
for i in range(t):
	print(int(b[i]))


import os

def f(n):
	k = 2
	while True:
		(x, r) = divmod(n, 2 ** k - 1)
		if r == 0:
			return x
		k += 1

def pp(input):
	n_test = int(input())
	for i in range(n_test):
		print(f(int(input())))
if 'paalto' in os.getcwd():
	from string_source import string_source
	s = string_source('7\n    3\n    6\n    7\n    21\n    28\n    999999999\n    999999984')
	pp(s)
else:
	pp(input)


l = []
i = 2
n = 4
while n <= 1000000000:
	l.append(n - 1)
	i += 1
	n *= 2
t = int(input())
while t > 0:
	n = int(input())
	for i in l:
		if n % i == 0:
			print(n // i)
			break
	t -= 1


pow = [1]
for i in range(1, 31):
	pow.append(pow[-1] + 2 ** i)
for i in range(int(input())):
	n = int(input())
	for j in pow[1:]:
		if n % j == 0:
			print(n // j)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 3
	k = 2
	while 1:
		if n % ans == 0:
			print(n // ans)
			break
		else:
			ans += 2 ** k
			k += 1


from math import log2, ceil, floor
for _ in range(int(input())):
	n = int(input())
	if ceil(log2(n + 1)) == floor(log2(n + 1)):
		print(1)
	else:
		li = [1]
		for i in range(1, 1000):
			li.append(2 ** i)
			if ceil(n / sum(li)) == floor(n / sum(li)):
				print(n // sum(li))
				break


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		temp = 1
		for i in range(2, 10 ** 9):
			temp += 2 ** (i - 1)
			if n / temp == int(n / temp):
				print(int(n / temp))
				break
main()


inputs = []
outputs = []
k_max = 100
j_old = -1
for _ in range(int(input())):
	inputs.append(int(input()))

def find_k(k):
	if k >= 0:
		result = 2 ** k + find_k(k - 1)
	else:
		result = 0
	return result
for j in inputs:
	if j != j_old:
		for i in range(1, k_max):
			x = j / find_k(i)
			if int(x) == x:
				print(int(x))
				break
		j_old = j
	else:
		print(int(x))


for _ in range(int(input())):
	n = int(input())
	pr = 4
	x = 0
	while True:
		if n % (pr - 1) == 0:
			x = n // (pr - 1)
			break
		pr = 2 * pr
	print(x)


for _ in range(int(input())):
	a = int(input())
	n = 2
	while True:
		if a % (pow(2, n) - 1) == 0:
			print(a // (pow(2, n) - 1))
			break
		else:
			n += 1


s = []
for i in range(2, 31):
	s.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	for j in s:
		if n % j == 0:
			print(int(n / j))
			break


try:
	from math import *
	for _ in range(int(input())):
		n = int(input())
		a = ceil(sqrt(n))
		for i in range(2, a + 1):
			b = pow(2, i) - 1
			if n % b == 0:
				print(int(n // b))
				break
except:
	pass


from math import log2

def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		i = 2
		while True:
			if n % (2 ** i - 1) == 0:
				print(n // (2 ** i - 1))
				break
			i += 1
main()


import math
testcases = int(input())
for i in range(testcases):
	n = int(input())
	for k in range(2, 35):
		if n % (2 ** k - 1) == 0:
			x = math.ceil(n / (2 ** k - 1))
			break
	print(x)


N = int(input())
for i in range(N):
	n = int(input())
	k = 2
	x = None
	while True:
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			break
		k += 1
	print(x)


c = int(input())

def check(n):
	for j in range(2, n):
		sum_of_twos = (1 - 2 ** j) / (1 - 2)
		if n / sum_of_twos % 1 == 0:
			print(int(n / sum_of_twos))
			return int(n / sum_of_twos)
for i in range(c):
	k = int(input())
	check(k)


t = int(input())
for _ in range(t):
	n = int(input())
	res2 = 9999999999
	for i in range(2, n):
		p = pow(2, i)
		res = n / (p - 1)
		if res > 0 and res == int(res):
			res2 = min(res2, res)
			print(int(res2))
			break


N = int(input())
for _ in range(N):
	n = int(input())
	i = 2
	while n % (2 ** i - 1) != 0:
		i += 1
	print(n // (2 ** i - 1))


powof2 = [1]
for i in range(30):
	powof2.append(powof2[i] * 2)
for t in range(int(input().strip())):
	n = int(input().strip())
	i = 2
	while i < 30:
		if n % (powof2[i] - 1) == 0:
			break
		i += 1
	print(n // (powof2[i] - 1))


cases = int(input())
while cases != 0:
	wrapper = int(input())
	xmultsum = 3
	k = 2
	while wrapper % xmultsum:
		xmultsum = xmultsum + 2 ** k
		k = k + 1
	print(wrapper // xmultsum)
	cases = cases - 1


def find(a, t):
	b = []
	for i in range(t):
		div = 1
		k = 2
		while True:
			if a[i] % (pow(2, k) - 1) == 0:
				c = a[i] // (pow(2, k) - 1)
				break
			else:
				k += 1
		print(c)
t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
find(a, t)


for sss in range(int(input())):
	r = 1
	n = int(input())
	for i in range(1, n):
		r += 2 ** i
		if n % r == 0:
			print(n // r)
			break


t = int(input())
while t is not 0:
	n = int(input())
	k = 1
	c = 1
	x = 0.5
	while x != int(x):
		k += 1
		c += pow(2, k - 1)
		x = n / c
	print(int(x))
	t -= 1


li = []
for i in range(2, 33):
	li.append(pow(2, i) - 1)
t = int(input())
for hh in range(0, t):
	n = int(input())
	for j in li:
		if n % j == 0:
			print(n // j)
			break


for _ in range(int(input())):
	n = int(input())
	sum1 = 3
	k = 2
	while True:
		if n % sum1 == 0:
			print(n // sum1)
			break
		k = k * 2
		sum1 = sum1 + k


T = int(input())
for case in range(T):
	n = int(input())
	num = 3
	while n % num != 0:
		num = (num << 1) + 1
	print(n // num)


for t in range(int(input())):
	n = int(input())
	r = 2
	k = 3
	while 1:
		if n % k == 0:
			break
		k = k + r * 2
		r = r * 2
	print(n // k)


query = int(input())
for _ in range(query):
	num = int(input())
	for i in range(2, 30):
		s = 2 ** i - 1
		if not num % s:
			break
	print(num // s)


import math

def solve():
	t = int(input())
	arr = []
	for _ in range(t):
		n = int(input())
		arr.append(n)
	for n in arr:
		for k in range(2, n):
			x = n / (2 ** k - 1)
			if x.is_integer():
				print(int(x))
				break
solve()


import math

def s():
	n = int(input())
	for i in range(2, n):
		sum = (pow(2, i) - 1) / (2 - 1)
		if (n / sum).is_integer():
			print(int(n / sum))
			break
t = int(input())
for i in range(t):
	s()


t = int(input())
for o in range(t):
	n = int(input())
	k = 2
	for i in range(0, n):
		d = 2 ** k
		e = d - 1
		if n % e == 0:
			print(int(n / e))
			break
		else:
			k += 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = int(math.log2(n))
	for j in range(2, x + 2):
		q = 2 ** j - 1
		if n % q == 0:
			print(int(n / q))
			break


p = int(input())
for i in range(p):
	n = int(input())
	k = 2
	while True:
		x = n / (pow(2, k) - 1)
		if x % 1 == 0:
			print(int(x))
			break
		k += 1


import math
t = int(input())
for _ in range(t):
	n = int(input())
	c = 4
	while 1:
		if n % (c - 1) == 0:
			ans = n // (c - 1)
			break
		c *= 2
	print(ans)


t = int(input())
for j in range(t):
	n = int(input())
	ni = 3
	i = 2
	while True:
		if n % ni == 0:
			print(n // ni)
			break
		else:
			ni += 2 ** i
			i += 1


t = int(input())
while t != 0:
	n = int(input())
	for i in range(2, 10000000):
		if n / (pow(2, i) - 1) == int(n / (pow(2, i) - 1)):
			print(int(n / (pow(2, i) - 1)))
			break
	t -= 1


from math import factorial as fac
from collections import defaultdict
from copy import deepcopy
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
sys.setrecursionlimit(10 ** 6)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
from collections import deque, defaultdict
import heapq

def bfs(V, E):
	s = set()
	print('\n'.join(map(str, E.items())))
	cnt = 0
	for v in V:
		if v in s:
			continue
		q = deque([])
		s.add(v)
		q.append(v)
		while len(q) > 0:
			x = q.popleft()
			for e in E[x]:
				if e not in s:
					s.add(e)
					q.append(e)
			print(q)
		cnt += 1
	return cnt

def regular_bs(L, x, l=None, r=None):
	l = 0 if l == None else l
	r = len(L) if r == None else r
	while r - l > 1:
		m = (r + l) // 2
		l = m if L[m] <= x else l
		r = m if L[m] > x else r
	return l if L[l] == x else -1
from typing import List, Tuple

class TreeNode:

	def __init__(self, x):
		self.val = x
		self.left = None
		self.right = None

	def __repr__(self):
		return f'({self.val}, {self.left.__repr__()}, {self.right.__repr__()})'

def helper(preorder: List[int], index, max_value=2 ** 300) -> Tuple[TreeNode, int]:
	if index >= len(preorder) or preorder[index] >= max_value:
		return (None, index)
	root_val = preorder[index]
	next_index = index + 1
	node = TreeNode(preorder[index])
	(node.left, next_index) = helper(preorder, next_index, root_val)
	(node.right, next_index) = helper(preorder, next_index, max_value)
	return (node, next_index)

def solution(n):
	for k in range(2, int(math.ceil(math.log2(n))) + 1):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)

def main():
	T = read_int()
	for i in range(T):
		n = read_int()
		print(solution(n))
main()


n_cases = int(input())
tests = []
for i in range(n_cases):
	c = int(input())
	tests.append(c)

def verify_candies(n):
	for k in range(2, 30):
		total = 2 ** k - 1
		if n % total == 0:
			print(n // total)
			return
for c in range(n_cases):
	verify_candies(tests[c])


T = int(input())
for i in range(T):
	N = int(input())
	k = 2
	gp = 2 ** k - 1
	if N % gp == 0:
		print(N // gp)
		continue
	while gp <= N:
		if N % gp == 0:
			print(N // gp)
			break
		k += 1
		gp = 2 ** k - 1


t = int(input())
for i in range(t):
	n = int(input())
	x = True
	k = 2
	while x == True:
		if n % (2 ** k - 1) == 0:
			x = False
			print(n // (2 ** k - 1))
		else:
			k += 1


import sys
input = sys.stdin.readline
import math
t = int(input())
for i1 in range(t):
	n = int(input())
	k = 2
	z = math.pow(2, k)
	while z - 1 <= n:
		if n % (z - 1) == 0:
			print(int(n // (z - 1)))
			break
		k += 1
		z = z * 2


t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	while True:
		p = pow(2, k) - 1
		if n % p == 0:
			ans = n / p
			print(int(ans))
			break
		else:
			k = k + 1


import sys

def getsum(n, mem={}):
	if n not in mem:
		mem[n] = 0
		for i in range(n + 1):
			mem[n] += 2 ** i
			mem[i] = mem[n]
	return mem[n]

def main():
	ans = ''
	for _ in range(int(input())):
		n = int(input())
		for i in range(1, n + 1):
			if not n % getsum(i):
				c_ans = int(n / getsum(i))
				break
		else:
			c_ans = int(n)
		ans += f'{c_ans}\n'
	sys.stdout.write(ans)
main()


from math import pow
a = [pow(2, i + 1) - 1 for i in range(1, 35)]
for _ in range(int(input())):
	n = int(input())
	for i in a:
		if n % i == 0:
			print(int(n // i))
			break


def solve(n):
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			break
		k += 1
	return n // (2 ** k - 1)
t = int(input())
while t:
	t = t - 1
	n = int(input())
	print(solve(n))


import sys

def solve():
	n = int(input())
	for i in range(2, 30):
		if n % ((1 << i) - 1) == 0:
			print(int(n / ((1 << i) - 1)))
			return
	print(-1)
while True:
	line = sys.stdin.readline()
	if not line:
		break
	for cas in range(int(line)):
		solve()


t = int(input())

def divisor(n):
	a = 3
	i = 2
	while n % a != 0:
		a += 2 ** i
		i += 1
	return a
for i in range(t):
	n = int(input())
	z = divisor(n)
	print(n // z)


t = int(input())
for i in range(t):
	a = int(input())
	k = 2
	while k:
		x = a / (pow(2, k) - 1)
		if x != int(x):
			k += 1
			continue
		else:
			print(int(x))
		break


t = int(input())
for _ in range(t):
	n = int(input())
	v = 2
	while 1:
		if n % ((1 << v) - 1) == 0:
			print(n // ((1 << v) - 1))
			break
		else:
			v += 1


T = int(input())
while T:
	n = int(input())
	F = True
	p = 4
	a = 1
	while F:
		t = p - 1
		if n % t == 0:
			F = False
			a = n // t
		p = p * 2
	print(a)
	T = T - 1


t = int(input())
for i in range(t):
	n = int(input())
	p = 3
	while n % p:
		p = p * 2 + 1
	print(n // p)


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			break
	print(x)


def asolution():
	t = int(input())
	while t != 0:
		n = int(input())
		varik = 1
		piem = 1
		while True:
			varik += 2 ** piem
			piem += 1
			if n % int(varik) == 0:
				n = n / varik
				print(round(n))
				break
		t -= 1
asolution()


t = int(input())
while t:
	t = t - 1
	n = int(input())
	i = 2
	while True:
		y = pow(2, i) - 1
		if n % y == 0:
			print(int(n / y))
			break
		else:
			i = i + 1


class inp:

	@staticmethod
	def int():
		return int(input())

def main():
	po2 = []
	x = 8
	while x <= 10 ** 9 + 1:
		po2.append(x - 1)
		x *= 4
	t = inp.int()
	for _ in range(t):
		n = inp.int()
		if n % 3 == 0:
			print(n // 3)
		else:
			for p2 in po2:
				if n % p2 == 0:
					print(n // p2)
					break
main()


for i in range(int(input())):
	n = int(input())
	bN = list(bin(n).replace('0b', ''))
	if bN.count('0') == 0:
		print(n // (1 << len(bN) - 1))
	else:
		x = (1 << 2) - 1
		i = 3
		while x < n and n % x != 0:
			x = (1 << i) - 1
			i += 1
		print(n // x)


t = int(input())
for w in range(t):
	n = int(input())
	i = 2
	k1 = 3
	while k1 <= n:
		if n % k1 == 0:
			print(n // k1)
			break
		i += 1
		k1 = pow(2, i) - 1


T = int(input())
x = 0
flag = 0
for _ in range(0, T):
	n = int(input())
	if n % 3 == 0:
		x = n // 3
		flag = 1
	elif n % 7 == 0:
		x = n // 7
		flag = 1
	for i in range(2, n):
		if n / (2 ** i - 1) == int(n / (2 ** i - 1)):
			x = n / (2 ** i - 1)
			break
	print(int(x))


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(itg()):
	n = itg()
	c = 2
	while n % ((1 << c) - 1) != 0:
		c += 1
	print(n // ((1 << c) - 1))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	while True:
		s = int((1 - math.pow(2, i)) / -1)
		if n % s == 0:
			print(int(n / s))
			break
		i += 1


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline
pow2 = [1]
for i in range(30):
	pow2.append((pow2[-1] + 1) * 2 - 1)
pow2.pop(0)

def solve():
	n = int(input())
	for el in pow2:
		if n % el == 0:
			print(n // el)
			return
tt = int(input())
for test in range(tt):
	solve()


t = int(input())
ls = []
for i in range(t):
	ls.append(int(input()))
x = int
for i in range(t):
	for k in range(2, 30):
		if ls[i] % (pow(2, k) - 1) == 0:
			x = ls[i] // (pow(2, k) - 1)
			print(x)
			break


t = int(input())
for test in range(t):
	k = 2
	n = int(input())
	switch = False
	ans = 0
	while not switch:
		if n % (2 ** k - 1) == 0:
			ans = n / (2 ** k - 1)
			switch = True
		else:
			k += 1
	print(int(ans))


import math

def find(n):
	for k in range(2, 32):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)

def main():
	tests = int(input())
	while tests:
		n = int(input())
		print(find(n))
		tests -= 1
main()


a = int(input())
for i in range(0, a):
	x = int(input())
	sum = 3
	i = 2
	while x % sum != 0:
		sum += 2 ** i
		i += 1
	print(int(x / sum))


import math, sys
input = sys.stdin.readline
for t in range(int(input())):
	n = int(input())
	for k in range(1, math.floor(math.log2(n)) + 1):
		if n % (pow(2, k + 1) - 1) == 0:
			print(n // (pow(2, k + 1) - 1))
			break


import math
tc = int(input())
while tc > 0:
	n = int(input())
	temp = math.log(n + 1, 2)
	for k in range(2, int(temp + 1)):
		expo_k = math.pow(2, k)
		x = n / (expo_k - 1)
		if x == int(x):
			print(int(x))
			break
	tc = tc - 1


a = [2 ** (k + 1) - 1 for k in range(1, 30)]
for _ in range(int(input())):
	n = int(input())
	i = 0
	while i < len(a) and n % a[i] != 0:
		i += 1
	print(n // a[i])


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
arr = [1]
for i in range(1, 31):
	arr.append(arr[-1] + 2 ** i)
tc = ii1()
for _ in range(tc):
	n = ii1()
	for i in arr[1:]:
		if n % i == 0:
			print(n // i)
			break


l = []
l.append(1)
for i in range(1, 60):
	l.append(2 * l[-1])
l2 = []
l2.append(l[0])
for i in range(1, 60):
	l2.append(l2[-1] + l[i])
l2.pop(0)
testcases = int(input())
l1 = []
for _ in range(testcases):
	n = int(input())
	l1.append(n)
for i in l1:
	for j in l2:
		if i % j == 0:
			print(i // j)
			break


nb_cases = int(input())
while nb_cases > 0:
	nb_cases -= 1
	n = int(input())
	k = 1
	while True:
		k += 1
		x = n / (2 ** k - 1)
		if x.is_integer():
			break
	print(int(x))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 30):
		p = int(math.pow(2, k))
		p -= 1
		if n % p == 0:
			print(int(n / p))
			break


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	k = 2
	while True:
		temp = 2 ** k - 1
		x = n / temp
		if x == int(x):
			print(int(x))
			break
		k += 1


t = int(input())
for tc in range(t):
	n = int(input())
	i = 2
	while 1:
		v = pow(2, i) - 1
		if n % v == 0:
			print(n // v)
			break
		i += 1


t = int(input())
ans = []
while t > 0:
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	x = n // (2 ** k - 1)
	ans.append(x)
	t -= 1
for i in range(0, len(ans)):
	print(ans[i])


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	TOL = 1e-10
	while 2 ** k - 1 <= n:
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			print(x)
			break
		k += 1


def check(n):
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			break
		else:
			k += 1
	return k
t = int(input())
ans = []
i = 0
while i < t:
	n = int(input())
	k = check(n)
	ans.append(n / (2 ** k - 1))
	i += 1
for a in ans:
	print(int(a))


inp = input()
for _ in range(int(inp)):
	n = int(input())
	k = 1
	s = 1
	while True:
		s += 2 ** k
		k += 1
		if n % s == 0:
			print(int(n / s))
			break


def test_a(n):
	k = 2
	k_pow_two = 2 ** k - 1
	while k_pow_two <= n:
		if n / k_pow_two == n // k_pow_two:
			return n // k_pow_two
		k += 1
		k_pow_two = 2 ** k - 1
t = int(input())
for i in range(t):
	n = int(input())
	x = test_a(n)
	print(x)


cases = int(input())
for j in range(cases):
	t = int(input())
	power = 1
	total = 3
	while t % total != 0:
		power += 1
		total += 2 ** power
	print(int(t / total))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	k = 1
	somme = 1
	while n / somme != int(n / somme) or k == 1:
		somme += 2 ** k
		k += 1
	print(int(n / somme))


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
from math import log2
for _ in range(I()[0]):
	n = I()[0]
	l = 4
	while l <= n:
		if n % (l - 1) == 0:
			break
		else:
			l *= 2
	print(n // (l - 1))


import math

def lists():
	l = list([])
	k = 4
	while k < math.pow(10, 9):
		l.append(k - 1)
		k *= 2
	return l
l = lists()
for _ in range(int(input())):
	n = int(input())
	for each in l:
		if n % each == 0:
			print(n // each)
			break


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	i = 2
	while 1:
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
		i += 1


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	num = int(sys.stdin.readline())
	i = 2
	result = 3
	while num % result:
		result += 2 ** i
		i += 1
	print(num // result)


n = int(input())
n1 = 1
while n1 <= n:
	m = int(input())
	k = 2
	while True:
		x = m / (2 ** k - 1)
		if int(x) == float(x):
			break
		else:
			k += 1
	print(int(x))
	n1 = n1 + 1


t = int(input())
l = []
a = 2
for i in range(32):
	l.append(a - 1)
	a *= 2
l.pop(0)
while t:
	n = int(input())
	for i in l:
		if n % i == 0:
			print(n // i)
			break
	t -= 1


for _ in range(int(input())):
	n = int(input())
	k = 4
	while k - 1 <= n:
		x = n // (k - 1)
		if x * (k - 1) == n:
			print(x)
			break
		k = k * 2


cant = int(input())
while cant > 0:
	cant -= 1
	n = int(input())
	k = 2
	suma = 3
	while n % suma:
		suma += k * 2
		k *= 2
	print(n // suma)


t = int(input())
for tt in range(t):
	n = int(input())
	k = 2
	for k in range(2, 36):
		if n % (2 ** k - 1) == 0:
			print(round(n / (2 ** k - 1)))
			break


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	c = 1
	p = 1
	for _ in range(n):
		p *= 2
		c += p
		if n % c == 0:
			print(n // c)
			break


import sys

def main():
	t = int(input())
	for _ in range(t):
		num = int(sys.stdin.readline().strip())
		temp = 3
		cnt = 4
		while num % temp:
			temp += cnt
			cnt <<= 1
		print(num // temp)
	return
main()


t = int(input())
for i in range(t):
	n = int(input())
	i = 1
	temp = 1
	while temp + i * 2 <= n:
		temp += i * 2
		i *= 2
		if n % temp == 0:
			break
	print(int(n / temp))


import sys
input = sys.stdin.readline
import random, bisect
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
t = I()
for _ in range(t):
	n = I()
	k = 3
	while n % k != 0:
		k *= 2
		k += 1
	print(n // k)


test = int(input())
for i in range(0, test):
	n = int(input())
	j = 2
	x = 3
	ok = 1
	while ok:
		if n % x == 0:
			print(n // x)
			break
		j = j * 2
		x = x + j


t = int(input())
while t:
	n = int(input())
	k = 2
	while n % ((1 << k) - 1):
		k = k + 1
	print(n // ((1 << k) - 1))
	t = t - 1


t = int(input())
for i in range(t):
	a = int(input())
	k = 2
	while a % (2 ** k - 1) > 0:
		k += 1
	print(a // (2 ** k - 1))


t = int(input())
for i in range(t):
	n = int(input())
	sums = 3
	adder = 2
	while True:
		if n % sums == 0:
			break
		else:
			adder *= 2
			sums += adder
	print(int(n / sums))


for _ in range(int(input())):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k = k + 1
	x = n // (2 ** k - 1)
	print(x)


t = input()
t = int(t)
while t != 0:
	x = input()
	x = int(x)
	count = 1
	w = 1
	while True:
		p = 2 ** count
		w = w + p
		if x % w == 0:
			ans = x / w
			break
		count = count + 1
	print(int(ans))
	t = t - 1


t = int(input())
for h in range(t):
	n = int(input())
	k = 4
	while n % (k - 1) != 0:
		k *= 2
	print(n // (k - 1))


def solve(n):
	kp = 4
	while True:
		if n % (kp - 1) == 0:
			return n // (kp - 1)
		else:
			kp = kp * 2
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


def find(n):
	for k in range(2, 32):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)
t = int(input())
while t:
	n = int(input())
	print(find(n))
	t -= 1


nbtest = int(input())
for i in range(nbtest):
	n = int(input())
	j = 2
	condition = False
	while not condition:
		j = j * 2
		if n % (j - 1) == 0:
			print(n // (j - 1))
			condition = True


n = int(input())
inp = []
for i in range(n):
	aux = int(input())
	inp.append(aux)
for item in inp:
	total = 3
	k = 2
	while item % total != 0:
		total += k * 2
		k *= 2
	result = item / total
	print(int(result))


import math
t = int(input())
for i in range(t):
	n = int(input())
	k = math.ceil(math.log(n, 2))
	l = []
	for i in range(2, k + 1):
		l.append(2 ** i - 1)
	for el in l:
		if n % el == 0:
			print(n // el)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	for k in range(2, 1000):
		if n % (2 ** k - 1) == 0:
			ans = n // (2 ** k - 1)
			break
	print(ans)


import math as m

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		for i in range(2, 30):
			if n % (m.pow(2, i) - 1) == 0:
				print(int(n // (m.pow(2, i) - 1)))
				break
main()


tests = int(input())
while tests > 0:
	tests -= 1
	n = int(input())
	sum = 0
	cur = 1
	ans = -1
	for k in range(1, 32):
		sum += cur
		if n % sum == 0 and cur > 1:
			ans = int(n / sum)
			break
		cur += cur
	print(ans)


t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for n in a:
	t = 3
	k = 2
	while n % t != 0:
		t += 2 ** k
		k += 1
	print(int(n / t))


T = int(input())
for _ in range(T):
	n = int(input())
	for i in range(2, 10 ** 6):
		z = n / (2 ** i - 1)
		if float(z).is_integer():
			print(int(z))
			break


import sys
import collections
import threading

def main():
	n = int(input())
	k = 2
	sum = 3
	while k < 40 and n % sum > 0:
		k += 1
		sum += 2 ** (k - 1)
	print(n // sum)
input = sys.stdin.readline
tnum = int(input())
for _ in range(tnum):
	main()


for _ in range(int(input())):
	one = int(input())
	two = [1]
	power = 1
	add = 0
	while add <= one:
		two.append(2 ** power)
		add = sum(two)
		if one % add == 0:
			print(one // add)
			break
		else:
			power += 1
			continue


t = 1
s = 1
stwo = [s]
while t < 1000000000:
	t *= 2
	stwo.append(stwo[-1] + t)
stwo.remove(1)
x = int(input())
for _ in range(x):
	n = int(input())
	for s in stwo:
		if n % s == 0:
			print(n // s)
			break


t = int(input())
for i in range(t):
	n = int(input())
	found = False
	i = 1
	sum1 = 0
	while not found:
		sum1 = 2 ** i + sum1
		sum2 = sum1 + 1
		if n % sum2 == 0:
			found = True
		else:
			i = i + 1
	print(n // sum2)


x = [1]
for i in range(1, 31):
	x.append(x[-1] + 2 ** i)
for tc in range(int(input())):
	n = int(input())
	ans = 1
	if n in x:
		print(1)
	else:
		for i in x[1:]:
			if n // i == n / i:
				print(n // i)
				break


from sys import stdin, stdout
from math import ceil
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007

def solve():
	n = inp()
	a = 3
	c = 2
	while n % a != 0:
		a += pow(2, c)
		c += 1
	pr(n // a)
for _ in range(inp()):
	solve()


for _ in range(int(input())):
	n = int(input())
	(num, tmp) = (1, 1)
	while n % (tmp + 2 ** num) and n >= 3:
		tmp += 2 ** num
		num += 1
	print(1 if n < 3 else n // (tmp + 2 ** num))


try:
	for _ in range(int(input())):
		n = int(input())
		(x, k) = (1, 1)
		for i in range(2, 30):
			if n % (2 ** i - 1) == 0:
				x = n // (2 ** i - 1)
				if x != 0:
					print(x)
					break
except EOFError as e:
	pass


l = [2 ** k - 1 for k in range(2, 35)]
t = int(input())
for i in range(t):
	n = int(input())
	for elem in l:
		if n % elem == 0:
			print(n // elem)
			break


total = int(input())
for _ in range(total):
	n = list(map(int, input().split()))[0]
	k = 2
	while 2 ** k - 1 <= n:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		k += 1


from sys import stdin, stdout

def find(N):
	a = 2
	for i in range(32):
		a <<= 1
		z = a - 1
		if N % z == 0:
			return N // z

def main():
	for i in range(int(input())):
		N = int(stdin.readline())
		stdout.write(str(find(N)) + '\n')
main()


for _ in range(int(input())):
	n = int(input())
	div = 1
	i = 1
	while i < 35:
		div += 2 ** i
		if n % div == 0:
			break
		i += 1
	print(n // div)


test = int(input())
while test:
	n = int(input())
	x = 1
	p = 2
	a = 1
	while 1:
		x += p
		p *= 2
		if n % x == 0:
			break
	print(n // x)
	test -= 1


def gogo(n):
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		print(gogo(n))
main()


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	n = int(input())
	k = 3
	i = 2
	while n % k != 0:
		i += 1
		k = 2 ** i - 1
	print(n // k)
T = int(input())
for _ in range(1, T + 1):
	solve()


for _ in range(int(input())):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0 and k < n:
		k += 1
	if n % (2 ** k - 1) == 0:
		print(int(n / (2 ** k - 1)))
	else:
		print('Нет решения')


def solve(n):
	start = 3
	base = 2
	while n % start:
		base = base * 2
		start += base
	return int(n / start)
testCases = int(input())
while testCases:
	n = int(input())
	print(solve(n))
	testCases -= 1


t = int(input())
for i in range(t):
	p = int(input())
	k = 2
	while k <= 29:
		if p % (pow(2, k) - 1) == 0:
			print(int(p / (pow(2, k) - 1)))
			break
		else:
			k += 1


t = int(input())
while t > 0:
	n = int(input())
	cd = 1
	i = 2
	while True:
		m = pow(2, i) - 1
		if n % m == 0:
			print(n // m)
			break
		else:
			i += 1
	t = t - 1


import math
for _ in range(int(input())):
	n = int(input())
	k = 2
	x = 0
	while n % (pow(2, k) - 1) != 0:
		k += 1
	x = n // (pow(2, k) - 1)
	print(x)


import sys

def input():
	return sys.stdin.readline()[:-1]
ans = [(1 << i) - 1 for i in range(2, 31)]
t = int(input())
for _ in range(t):
	n = int(input())
	for x in ans:
		if n % x == 0:
			print(n // x)
			break


N = int(input())
while N > 0:
	N = N - 1
	T = int(input())
	i = 1 << 2
	while True:
		if T % (i - 1) == 0:
			print(int(T / (i - 1)))
			break
		i = i << 1


import math
t = int(input())
for _ in range(t):
	n = int(input())
	k = 3
	temp = math.pow(2, k - 1) - 1
	res = n / temp
	if res == int(res):
		print(int(res))
	else:
		while res != int(res):
			k = k + 1
			temp = math.pow(2, k - 1) - 1
			res = n / temp
			if res == int(res):
				print(int(res))
				break


cases = int(input())
for case in range(cases):
	n = int(input())
	for k in range(2, 30):
		val = 2 ** k - 1
		if n % val == 0:
			print(n // val)
			break


t = int(input())
f = 3
a = []
b = []
for i in range(t):
	a.append(int(input()))
	while a[i] % f != 0:
		f = f * 2 + 1
	b.append(a[i] // f)
	f = 3
for i in range(t):
	print(b[i])


t = int(input())
while t > 0:
	n = int(input())
	v = 4
	while True:
		if n % (v - 1) == 0:
			print(n // (v - 1))
			break
		v = v * 2
	t = t - 1


for i in range(int(input())):
	n = int(input())
	for i in range(2, 30):
		if n % (pow(2, i) - 1) == 0:
			print(int(n / (pow(2, i) - 1)))
			break


import math
t = int(input())
for i in range(t):
	n = int(input())
	d = 2
	k = 2 ** d - 1
	while n % k:
		d += 1
		k = 2 ** d - 1
	print(n // k)


from collections import *
from bisect import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	k = 2
	while 1:
		z = int(pow(2, k) - 1)
		if n % z == 0:
			print(n // z)
			break
		k += 1


import math
import atexit
import io
import sys
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def array_to_string(a):
	s = ''
	for i in a:
		s += str(i)
	return s
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	for k in range(2, 10 ** 9):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


two_powers = [2 ** x - 1 for x in range(2, 30)]
for _ in range(int(input())):
	n = int(input())
	for num in two_powers:
		if n % num == 0:
			print(n // num)
			break


import math
t = int(input())
for g in range(0, t):
	n = int(input())
	k = 2
	r = 1
	while r != 0:
		r = n % (2 ** k - 1)
		k = k + 1
	k = k - 1
	print(int(n / (2 ** k - 1)))


def mempow(a, b):
	temp = 1
	yield temp
	for i in range(b):
		temp = temp * a
		yield temp
t = int(input())
mem = []
for x in mempow(2, 30):
	mem.append(x - 1)
for i in range(t):
	n = int(input())
	for j in range(2, 31):
		dm = divmod(n, mem[j])
		if dm[1] == 0:
			print(dm[0])
			break


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = int(math.log(n, 2)) + 1
	for j in range(2, x + 1):
		if n % (pow(2, j) - 1) == 0:
			print(int(n / (pow(2, j) - 1)))
			break


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		num = int(input())
		for i in range(1, 30):
			temp = int('1' * i, 2)
			if num % temp == 0:
				rem = num // temp
				if temp != 1:
					yield rem
					break
				elif rem + 1 & rem == 0:
					yield temp
					break
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	n = int(input())
	ans = 1
	for i in range(2, 10000000000000):
		ans += pow(2, i - 1)
		if n % ans == 0:
			print(n // ans)
			break


t = int(input())
for T in range(t):
	n = int(input())
	for j in range(2, 30):
		if n % (2 ** j - 1) == 0:
			print(n // (2 ** j - 1))
			break


import sys
t = int(sys.stdin.readline())
can = [1]
two = 1
while can[-1] < 10 ** 9:
	can.append(can[-1] + two * 2)
	two *= 2
for query in range(t):
	n = int(sys.stdin.readline())
	ans = 1
	pos = 1
	while pos < len(can) and can[pos] < n:
		if n % can[pos] == 0:
			ans = n // can[pos]
			break
		pos += 1
	print(ans)


from sys import stdin, stdout

def solve(n):
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			stdout.write(f'{n // (2 ** k - 1)}\n')
			return
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	solve(n)


import sys
import math

def ii():
	return sys.stdin.readline().strip()

def idata():
	return [int(x) for x in ii().split()]

def bfs(graph1, root1):
	visited1 = set()
	queue1 = [[root1, 0]]
	visited1.add(root1)
	(qw, ver) = (0, 1)
	while queue1:
		vertex1 = queue1[0]
		queue1 = queue1[1:]
		for neig1 in graph1[vertex1[0]]:
			if neig1 not in visited1:
				visited1.add(neig1)
				queue1 += [[neig1, vertex1[1] + 1]]
				if qw < vertex1[1] + 1:
					(ver, qw) = (neig1, vertex1[1] + 1)
	return (ver, qw)

def dfs(graph, ver):
	used_v = set()
	depth = [0] * (len(graph) + 1)
	level = [ver]
	num_of_level = 0
	while level:
		new_level = []
		for v in level:
			depth[v] = num_of_level
			used_v.add(v)
			for v1 in graph[v]:
				if v1 not in used_v:
					new_level += [v1]
		level = new_level
		num_of_level += 1
	return depth

def binary_search(array, x):
	(left, right) = (-1, len(array))
	while left + 1 != right:
		middle = (left + right) // 2
		if array[middle] >= x:
			right = middle
		elif array[middle] < x:
			left = middle
	return right

def c_mod(n1, k1, mod1):
	num = den = 1
	for i in range(n1 - k1):
		num = num * (n1 - i) % mod1
		den = den * (i + 1) % mod1
	return num * pow(den, mod1 - 2, mod1) % mod1

def c(n1, k1):
	num = den = 1
	for i in range(n1 - k1):
		num = num * (n1 - i)
		den = den * (i + 1)
	return num // den

def v_sistemu(x, k):
	x = int(x)
	z = ''
	while x:
		z += str(x % k)
		x //= k
	return z[::-1]

def iz_sistemi(x, k):
	x = str(x)[::-1]
	ans = 0
	for i in range(len(x)):
		ans += int(x[i]) * pow(k, i)
	return ans

def solve_of_problem():
	n = int(ii())
	ans = 2
	for i in range(n):
		ans *= 2
		if n % (ans - 1) == 0:
			print(n // (ans - 1))
			return
	return
for ______ in range(int(ii())):
	solve_of_problem()


Sn = [1]
num = 1
for i in range(1, 30):
	num *= 2
	last = Sn[-1]
	Sn.append(num + last)
test_cases = int(input())
for tc in range(test_cases):
	n = int(input())
	for i in range(1, len(Sn)):
		divisor = Sn[i]
		if n % divisor == 0:
			print(int(n / divisor))
			break


t = int(input())
while t:
	n = int(input())
	k = 2
	while True:
		m = 2 ** k - 1
		if n % m == 0:
			print(n // m)
			break
		k += 1
	t -= 1


def main():
	res = []
	sum = 1
	pot = 2
	while sum < 10 ** 9:
		res.append(sum)
		sum += pot
		pot = pot * 2
	del res[0]
	n_s = int(input())
	for x in range(n_s):
		n = int(input())
		x = 0
		while n % res[x] > 0:
			x += 1
		print(int(n / res[x]))
main()


n_cases = int(input())
for case_num in range(n_cases):
	n = int(input())
	p = 4
	while n % (p - 1) != 0:
		p *= 2
	print('{}'.format(n // (p - 1)))


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 10 ** 9):
		if pow(2, k) > 10 ** 9:
			break
		if n % (pow(2, k) - 1) == 0:
			ans = n // (pow(2, k) - 1)
			break
	print(ans)


import math

def solve(n):
	k = 2
	while True:
		den = math.pow(2, k) - 1
		if n % den == 0:
			return int(n / den)
		k += 1
t = int(input())
results = list()
for i in range(t):
	n = int(input())
	results.append(solve(n))
for result in results:
	print(result)


def find_ans(x):
	k = 2
	while True:
		if x % (2 ** k - 1) == 0:
			return x // (2 ** k - 1)
		k += 1
for _ in range(int(input())):
	print(find_ans(int(input())))


for i in range(int(input())):
	n = int(input())
	x = 1
	fl = 0
	for j in range(2, 1000000000):
		sum = 2 ** j - 1
		if n % sum == 0:
			print(n // sum)
			break


import math
t = int(input())
for _ in range(0, t):
	n = int(input())
	for i in range(1, 100000):
		if n % (2 ** (i + 1) - 1) == 0:
			print(int(n / (2 ** (i + 1) - 1)))
			break


t = int(input())
while t > 0:
	n = int(input())
	i = 2
	while i < n:
		val = pow(2, i) - 1
		if n % val == 0:
			print(n // val)
			break
		i = i + 1
	t -= 1


squares = [3]
total = 3
current_val = 2
for i in range(2, 40):
	current_val = 2 ** i
	total += current_val
	squares.append(total)
t = int(input())
for i in range(t):
	N = int(input())
	for num in squares:
		if N % num == 0:
			print(int(N / num))
			break


t = int(input())
for i in range(t):
	n = int(input())
	c = 0
	for k in range(2, 100):
		if n % (2 ** k - 1) == 0:
			c = n // (2 ** k - 1)
			break
	print(c)


for i in range(int(input())):
	n = int(input())
	s = 1
	p = 0
	log = 0
	for i in range(1, 32):
		s += 1 << i
		if n % s == 0 and log == 0:
			p = n / s
			log = 1
	print(int(p))


from sys import stdin
div = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647]

def main():
	t = int(stdin.readline().rstrip())
	for _ in range(t):
		x = int(stdin.readline().rstrip())
		for num in div:
			if x % num == 0 and num < x:
				print(int(x / num))
				break
			elif num >= x:
				print(1)
				break
main()


import math
t = int(input())
while t != 0:
	n = int(input())
	m = 3
	while n % m != 0:
		m = m * 2 + 1
	x = int(n / m)
	print(x)
	t -= 1


def candies(n):
	for j in range(2, 30):
		sum = 2 ** j - 1
		if n % sum == 0:
			print(n // sum)
			return
		elif sum > n:
			break

def main():
	t = int(input())
	for i in range(t):
		candies(int(input()))
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 1
	s = 3
	while s < n:
		if n % s == 0:
			break
		a += 1
		s += pow(2, a)
	print(n // s)


z = input
from math import *
n1 = int(z())
for _ in range(n1):
	n = int(z())
	for i in range(2, 29 + 1):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


for i in range(int(input())):
	n = int(input())
	divisor = 1
	i = 1
	while 1:
		divisor += pow(2, i)
		i += 1
		if n % divisor == 0:
			print(n // divisor)
			break


def main():
	T = int(input())
	A = [2 ** i for i in range(32)]
	from itertools import accumulate
	S = list(accumulate(A))
	for _ in range(T):
		N = int(input())
		for s in S[1:]:
			if N % s == 0:
				x = N // s
				print(x)
				break
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = 1
	b = 1
	while n % a != 0 or a == 1:
		a = a + 2 ** b
		b += 1
	n = n / a
	print(int(n))


import sys

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	l = 2
	for i in range(100):
		l *= 2
		if n % (l - 1) == 0:
			break
	print(n // (l - 1))


x = [pow(2, i) - 1 for i in range(2, 200)]
cases = int(input())
for _ in range(cases):
	n = int(input())
	flag = 1
	for i in range(len(x)):
		if n % x[i] == 0:
			print(n // x[i])
			flag = 0
			break
	if flag == 1:
		print(n % x[0])


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = 3
	while n % a != 0:
		a = (a << 1) + 1
	print(int(n / a))


def solve(n):
	m = 4
	while n % (m - 1) != 0:
		m *= 2
	return n // (m - 1)
t = int(input())
for i in range(t):
	print(solve(int(input())))


t = int(input())
for tc in range(t):
	n = int(input())
	k = 2
	while True:
		kk = 2 ** k - 1
		if n % kk == 0:
			print(n // kk)
			break
		k += 1


def solve(n):
	days = 2
	factor = 2 ** days - 1
	while n >= factor:
		factor = 2 ** days - 1
		if n % factor == 0:
			return n // factor
		else:
			days += 1
t = int(input())
for num in range(1, t + 1):
	n = int(input())
	answer = solve(n)
	print(answer)


x = int(input())
z = 1
for i in range(x):
	z = 1
	y = int(input())
	for j in range(1, 30):
		z += 2 ** j
		if y % z == 0:
			print(y // z)
			break


import atexit
import io
import sys
input = sys.stdin.readline
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for _ in range(int(input())):
	n = int(input())
	j = 2
	while True:
		k = pow(2, j)
		k = k - 1
		if n % k == 0:
			print(n // k)
			break
		j += 1


t = int(input())
for i in range(t):
	n = int(input())
	sum = 1
	res = 1
	while 1:
		res = res * 2
		sum = sum + res
		if n % sum == 0:
			print(n // sum)
			break


n = int(input())
for i in range(n):
	num = int(input())
	j = 4
	while 1:
		if num % (j - 1) == 0:
			print(num // (j - 1))
			break
		j *= 2


def print_sol(c, sol):
	print('Case #{}: {}'.format(c, sol))

def rd_int():
	return int(input())

def rd_str():
	return input()

def rd_str_lst():
	return input().split(' ')

def sp_str_lst():
	return list(input())

def rd_int_lst():
	return [int(i) for i in rd_str_lst()]

def sp_int_lst():
	return [int(i) for i in sp_str_lst()]

def next_point(x, y, dr):
	if dr == 'N':
		y += 1
	elif dr == 'S':
		y -= 1
	elif dr == 'E':
		x += 1
	else:
		x -= 1
	return (x, y)

def main():
	t = rd_int()
	for c in range(1, t + 1):
		n = rd_int()
		k = 2
		while n % (2 ** k - 1) != 0:
			k += 1
		x = n / (2 ** k - 1)
		print(int(x))
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	start = 4
	while True:
		temp = n / (start - 1)
		if temp == int(temp):
			print(int(temp))
			break
		else:
			start *= 2


m = 10 ** 9 + 7
t = int(input())
while t:
	t -= 1
	n = int(input())
	k = 2
	while True:
		if int(n / (2 ** k - 1)) == n / (2 ** k - 1):
			print(int(n / (2 ** k - 1)))
			break
		else:
			k += 1


import math
t = int(input())
for z in range(t):
	n = int(input())
	k = 2
	while math.pow(2, k) - 1 <= n:
		if n % (math.pow(2, k) - 1) == 0:
			break
		k += 1
	print(int(n / (math.pow(2, k) - 1)))


for _ in range(1, int(input()) + 1):
	n = int(input())
	for i in range(2, 36):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


M = 10 ** 6
t = int(input())
for i in range(t):
	somme = 1
	pui = 2
	n = int(input())
	for j in range(M):
		somme += pui
		pui *= 2
		if n % somme == 0:
			print(n // somme)
			break


t = int(input())
for i in range(t):
	n = int(input())
	u = 3
	k = 4
	while True:
		if n % u == 0:
			print(n // u)
			break
		u += k
		k *= 2


def solve(n):
	for i in range(2, 30):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			return
test = int(input())
while test != 0:
	n1 = int(input())
	solve(n1)
	test -= 1


t = int(input())
for test in range(t):
	y = int(input())
	coef = 4
	while y % (coef - 1) != 0:
		coef *= 2
	print(y // (coef - 1))


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	m = 0
	divisor = 0
	for i in range(0, n):
		m = 2 ** i
		divisor += m
		result = n / divisor
		if result.is_integer():
			if result != n:
				print(int(result))
				break


from math import *
t = int(input())
for j in range(t):
	x = 0
	n = int(input())
	for k in range(2, int(log(n + 1, 2)) + 1):
		x = n / (pow(2, k) - 1)
		if x == int(x) and x > 0:
			print(int(x))
			break


t = int(input())
t1 = t
ar = []
while t1 > 0:
	n = int(input())
	k = 2
	while True:
		x = n / (2 ** k - 1)
		if x % 1 == 0:
			break
		k += 1
	ar.append(int(x))
	t1 -= 1
for i in range(t):
	print(ar[i])


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	i = 2 * 2
	while 1:
		if n % (i - 1) == 0:
			print(n // (i - 1))
			break
		else:
			i = i * 2


import math
t = int(input())
res = []
for i in range(t):
	n = int(input())
	k = 2
	while True:
		s = 2 ** k - 1
		if n % s == 0:
			res.append(n // s)
			break
		k += 1
for i in res:
	print(i)


def solve(n):
	(sm, curr) = (3, 2)
	while n % sm != 0:
		curr *= 2
		sm += curr
	return n // sm
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


t = int(input())
sum2 = [1]
for k in range(1, 30):
	val = 2 ** k
	sum2.append(sum2[k - 1] + val)
while t:
	n = int(input())
	for k in sum2[1:]:
		x = n / k
		if x == int(x):
			print(int(x))
			break
	t -= 1


def r(k):
	return 2 ** k - 1
for _ in range(int(input())):
	n = int(input())
	i = 2
	while n % r(i) != 0:
		i = i + 1
	print(n // r(i))


def run():
	n = int(input())
	k = 2
	while True:
		sums = 2 ** k - 1
		if n % sums == 0:
			print(n // sums)
			return
		k += 1
t = int(input())
for i in range(t):
	run()


def func(n):
	for i in range(2, n):
		temp = 2 ** i - 1
		if n % temp == 0:
			print(n // temp)
			return
t = int(input())
for i in range(t):
	n = int(input())
	func(n)


def generate():
	mx = int(1000000000.0)
	x = int(1)
	while x <= mx:
		ar.append(x)
		ln = len(ar)
		if ln > 1:
			ar[ln - 1] = ar[ln - 1] + ar[ln - 2]
		x *= 2

def res(n):
	for i in ar:
		if i == 1:
			continue
		if n % i == 0:
			print(int(n / i))
			return
ar = []
generate()
t = int(input())
while t > 0:
	n = int(input())
	res(n)
	t -= 1


t = int(input())
while t:
	x = int(input())
	xx = 1
	while True:
		ttt = 2 ** (xx + 1) - 1
		if x % ttt == 0:
			print(x // ttt)
			break
		xx += 1
	t -= 1


from sys import stdin
import sys
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	for i in range(2, n):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


for _ in range(int(input())):
	num = int(input())
	(k, t) = (2, 1)
	while k <= num:
		t += 2 ** (k - 1)
		if num % t == 0:
			print(num // t)
			break
		else:
			k += 1


def num_input():
	return map(int, input().split())

def list_input():
	return list(num_input())
for t in range(int(input())):
	n = int(input())
	for i in range(2, 10 ** 5):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


def output(input):
	x = 0
	for i in range(2, 36):
		den = 2 ** i - 1
		if input % den:
			continue
		x = input / den
		break
	return int(x)
t = int(input())
for i in range(t):
	print(output(int(input())))


t = int(input())
for i in range(t):
	n = int(input())
	s = 1
	for k in range(40):
		s = s * 2 + 1
		if n % s == 0:
			print(n // s)
			break


import sys

def main():
	input = sys.stdin.readline
	t = int(input())
	while t > 0:
		t -= 1
		n = int(input())
		for pw in range(2, 30):
			val = (1 << pw) - 1
			if n % val == 0:
				print(n // val)
				break
main()


def solve(num):
	f = 3
	while True:
		if num % f == 0:
			return num // f
		f = (f << 1) + 1
for _ in range(int(input())):
	print(solve(int(input())))


t = int(input())
pows = []
step = 2
for i in range(1, 31):
	pows.append(step - 1)
	step *= 2
for _ in range(t):
	n = int(input())
	for i in range(1, 31):
		if n % pows[i] == 0:
			print(n // pows[i])
			break


def program():
	s = int(input())
	k = 2
	while True:
		if s % (2 ** k - 1) == 0:
			print(s // (2 ** k - 1))
			break
		k += 1
t = int(input())
for i in range(t):
	program()


import sys
input = sys.stdin.readline
A = []
for i in range(2, 31):
	A.append(2 ** i - 1)
T = int(input())
for _ in range(T):
	n = int(input())
	for i in A:
		if n % i == 0:
			x = n // i
			break
	print(x)


for _ in range(int(input())):
	x = int(input())
	st_num = 1
	mult = 2
	while True:
		st_num += mult
		if x % st_num == 0:
			print(int(x / st_num))
			break
		mult *= 2
	else:
		print(1)


import math
for i in range(int(input())):
	n = int(input())
	i = 3
	while n % i != 0:
		i = i * 2 + 1
	print(n // i)


t = int(input())
for _ in range(t):
	n = int(input())
	sumOfSeries = 3
	a = 4
	while sumOfSeries != n:
		if n % sumOfSeries == 0:
			break
		sumOfSeries += a
		a *= 2
	print(n // sumOfSeries)


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	ans = 0
	while 2 ** k - 1 <= n:
		y = 2 ** k - 1
		x = n % y
		if x == 0:
			ans = n // y
			break
		k += 1
	print(ans)


tab = [1, 3]
for i in range(100):
	xx = tab[-1]
	tab.append(xx + 2 ** (i + 2))
t = int(input())
for rew in range(t):
	n = int(input())
	wyn = -1
	for j in tab:
		if n % j == 0 and j > 1:
			wyn = n // j
			break
	print(wyn)


list_of_number = []
for i in range(2, 100):
	list_of_number.append(2 ** i - 1)
skolko = int(input())
chisla = []
for i in range(skolko):
	chisla.append(int(input()))
for i in chisla:
	for k in list_of_number:
		if i % k == 0:
			print(int(i // k))
			break


for _ in range(int(input())):
	n = int(input())
	y = 4
	while n % (y - 1) != 0:
		y = y * 2
	print(n // (y - 1))


import math
t = int(input())
while t:
	n = int(input())
	k = 2
	while 1:
		r = math.pow(2, k)
		r = int(r) - 1
		if n % r == 0:
			x = n // r
			print(x)
			break
		k = k + 1
	t = t - 1


def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	k = int(input())
	x = 1
	if isprime(k):
		print(x)
	else:
		for i in range(0, 32):
			if x > 0:
				x += pow(2, i)
			else:
				x += 1
			if k % (x - 1) == 0 and x - 1 > 1:
				break
	if x - 1 > 0:
		print(k // (x - 1))
T = int(input())
while T > 0:
	solve()
	T -= 1


from sys import stdin, stdout
import math
test = int(stdin.readline())
for _ in range(test):
	n = int(stdin.readline())
	for i in range(2, 31):
		temp = (1 << i) - 1
		if n % temp == 0:
			print(n // temp)
			break


for jj in range(int(input())):
	n = int(input())
	for i in range(2, 31):
		k = pow(2, i) - 1
		if n % k == 0:
			print(n // k)
			break


def main():
	for tin in range(int(input())):
		n = int(input())
		for _ in range(2, n + 1):
			if n / (2 ** _ - 1) == n // (2 ** _ - 1):
				print(n // (2 ** _ - 1))
				break
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	i = 3
	j = 2
	f = 0
	while i <= n:
		if float(n // i) == n / i:
			f = 1
			print(n // i)
			break
		j *= 2
		i = i + j
	if f == 0:
		print(n)


t = int(input())
while t > 0:
	n = int(input())
	for i in range(2, 32):
		k = pow(2, i) - 1
		if n % k == 0:
			print(n // k)
			break
	t -= 1


import sys
data = [int(x) for x in sys.stdin.read().strip().split('\n')]
table = [0] * 100
i = 1
j = 1
for z in range(100):
	i = i + 2 ** j
	table[z] = i
	j += 1
for x in data[1:]:
	for y in table:
		if x % y == 0:
			print(x // y)
			break


tests_num = int(input())
tests = [int(input()) for x in range(tests_num)]
for test in tests:
	num = 3
	exp = 2
	while test % num != 0:
		num += 2 ** exp
		exp += 1
	print(int(test / num))


ncases = int(input())
for i in range(ncases):
	s = int(input())
	n = 2
	while s / (2 ** n - 1) % 1 != 0:
		n = n + 1
	print(int(s / (2 ** n - 1)))


from math import log

def GetX(n):
	for k in range(2, int(log(n + 1, 2)) + 1):
		pow = 2 ** k - 1
		if n / pow == int(n / pow):
			return int(n / pow)
	return None
t = int(input())
a = []
for i in range(t):
	n = int(input())
	a.append(n)
for i in range(t):
	print(GetX(a[i]))


for _ in range(int(input())):
	n = int(input())
	x = 1
	k = 3
	for i in range(2, 31):
		if n % k == 0:
			x = n // k
			break
		k += 2 ** i
	print(x)


pow2 = []
for i in range(2, 50):
	pow2.append(2 ** i - 1)
T = int(input())
for t in range(T):
	n = int(input())
	for k in pow2:
		if n % k == 0:
			print(int(n / k))
			break


import math
from collections import Counter

def solve():
	n = int(input())
	k = 2
	for i in range(2, 32):
		k = k * 2
		k1 = k - 1
		if n % k1 == 0:
			p = n // k1
			print(p)
			return
for _ in range(int(input())):
	solve()


from sys import stdin
inp = stdin.readline
for _ in range(int(inp())):
	n = int(inp())
	i = 2
	x = -1
	while True:
		if n % (2 ** i - 1) == 0:
			x = n // (2 ** i - 1)
			break
		i += 1
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	j = 0
	while True:
		if s != 1 and s != 0 and (n % s == 0):
			break
		else:
			s = s + pow(2, j)
			j += 1
	print(int(n / s))


MOD = 10 ** 9 + 7
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

def main():
	test = int(input())
	for iteration in range(test):
		n = int(input())
		for i in range(2, 31):
			wh = 2 ** i - 1
			if n % wh == 0:
				print(n // wh)
				break
main()


from math import sqrt
from queue import Queue
import sys
sys.setrecursionlimit(10 ** 6)
nokfase = int(input())
for kase in range(nokfase):
	n = int(input())
	t = 4
	while True:
		if n % (t - 1) == 0:
			break
		t *= 2
	print(n // (t - 1))


t = int(input())
ans = [0 for _ in range(t)]
for _ in range(0, t):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	ans[_] = n // (2 ** k - 1)
for i in range(0, t):
	print(ans[i])


for s in [*open(0)][1:]:
	(n_sravya_18, k) = (int(s), 3)
	while n_sravya_18 % k:
		k -= ~k
	print(n_sravya_18 // k)


import sys, math
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			ans += str(n // (2 ** k - 1)) + '\n'
			break
		k += 1
print(ans)


t = int(input())
for i in range(t):
	a = int(input())
	k = 2
	while True:
		if not a % (2 ** k - 1):
			print(a // (2 ** k - 1))
			break
		k += 1


cases = input()
for i in range(int(cases)):
	number = int(input())
	for j in range(2, number):
		k = 2 ** j - 1
		if number % k == 0:
			print(number // k)
			break


t = int(input())
Ans = ''
for p in range(t):
	n = int(input())
	k = 4
	while n % (k - 1) != 0:
		k *= 2
	Ans += str(n // (k - 1)) + '\n'
print(Ans)


def solve(n):
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			return int(n / (2 ** k - 1))
		k += 1
t = int(input())
result = list()
for _ in range(t):
	n = int(input())
	result.append(solve(n))
for i in result:
	print(i)


T = int(input())
out = []
for i in range(T):
	n = int(input())
	k = 2
	while 1:
		temp = 2 ** k - 1
		if n % temp == 0:
			x = n // temp
			out.append(x)
			break
		k = k + 1
for i in range(T):
	print(out[i])


def solve(n):
	t = len(n)
	k = 10 ** 9
	result = []
	for i in n:
		for j in range(1, k):
			l = 2 ** (j + 1) - 1
			if i % l == 0:
				result.append(i // l)
				break
	return result
t = int(input().strip())
n = []
for _ in range(t):
	n.append(int(input().strip()))
result = solve(n)
print('\n'.join(map(str, result)))


t = int(input())
i = 0
while i < t:
	n = int(input())
	j = 2
	while 1:
		k = pow(2, j)
		k -= 1
		if n % k == 0:
			print(int(n / k))
			break
		j += 1
	i += 1


from collections import defaultdict
t = int(input())
d = []
s = x = 1
while True:
	x *= 2
	if x > 10000000000.0:
		break
	s += x
	d.append(s)
for _ in range(t):
	n = int(input())
	for x in d:
		if n % x == 0:
			print(n // x)
			break


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, n):
		x = n / (2 ** k - 1)
		if int(x) > 0 and n % x == 0:
			print(int(x))
			break


for _ in range(int(input())):
	(n,) = map(int, input().split())
	for k in range(2, 64):
		y = 2 ** k - 1
		if n % y == 0:
			print(n // y)
			break


from sys import stdin

def candies(n):
	res = 1
	k = 2
	while True:
		res += pow(2, k - 1)
		x = n // res
		if x * res == n:
			return x
		k += 1

def main():
	t = int(stdin.readline())
	for i in range(t):
		n = int(stdin.readline())
		print(candies(n))
main()


for i in range(0, int(input())):
	n = int(input())
	p = 2
	while n % (2 ** p - 1) != 0:
		p = p + 1
	print(n // (2 ** p - 1))


from math import log, ceil
t = int(input())
for _ in range(t):
	n = int(input())
	k = ceil(log(n, 2))
	for i in range(2, k + 1):
		p = pow(2, i) - 1
		if n % p == 0:
			print(n // p)
			break


def main():
	t = int(input())
	while t:
		x = int(input())
		k = 2
		while True:
			k *= 2
			if x % (k - 1) == 0:
				print(x // (k - 1))
				break
		t -= 1
main()


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	sum = 3
	while n % sum != 0:
		k *= 2
		sum += k
	print(n // sum)


t = int(input())
for i in range(t):
	s = int(input())
	temp = 4
	d = 3
	f = 1
	while f == 1:
		if s % d == 0:
			print(int(s / d))
			f = 0
		else:
			d = d + temp
			temp = temp * 2


import math

def solve(n):
	stop = math.ceil(math.log2(float(n)))
	stop = int(stop)
	for i in range(2, stop + 1):
		if n % (math.pow(2, i) - 1) == 0:
			print(int(n // (math.pow(2, i) - 1)))
			break
for i in range(int(input())):
	n = int(input())
	solve(n)


t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	k = 2
	d = 3
	while n % d != 0:
		k *= 2
		d += k
	print(n // d)


t = int(input())

def solve(n):
	for k in range(2, 40):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)
li = []
for _ in range(t):
	li.append(int(input()))
for i in li:
	print(solve(i))


import math
test = int(input())
while test != 0:
	n = int(input())
	till = int(math.log(n + 1, 2))
	k = -1
	for i in range(2, till + 1):
		if n % (2 ** i - 1) == 0:
			print(int(n / (2 ** i - 1)))
			break
	test -= 1


import math
for q in range(int(input())):
	n = int(input())
	k = int(math.log2(n + 1))
	for i in range(2, k + 1):
		a = 2 ** i - 1
		if n % a == 0:
			print(n // a)
			break


def printc(t, data=None):
	if data == None:
		print('Case #' + str(t) + ':')
	else:
		print('Case #' + str(t) + ':', data)

def input_num_list():
	s = input().split(' ')
	L = []
	for e in s:
		L.append(int(e))
	return L

def input_num_matrix(N):
	M = []
	for i in range(N):
		M.append(input_num_list())
	return M

def inti():
	return int(input())
T = inti()
for t in range(1, T + 1):
	n = inti()
	k = 2
	d = 2 ** k - 1
	while n % d != 0:
		k += 1
		d += 2 ** (k - 1)
	print(n // d)


import math
t = int(input())
l = []
for i in range(0, t):
	l.append(int(input()))
for i in l:
	(z, k) = (1, 2)
	for a in range(0, 1000000000):
		z = z + pow(2, k - 1)
		if i % z == 0:
			print(i // z)
			break
		else:
			k = k + 1


from collections import deque
from collections import OrderedDict
import math
arrayS2 = []
arraySum = [1]
for i in range(32):
	arrayS2.append(2 ** i)
	if i != 0:
		arraySum.append(arrayS2[i] + arraySum[i - 1])
for i in range(int(input())):
	value = int(input())
	for j in range(1, len(arraySum)):
		if value % arraySum[j] == 0:
			print(value // arraySum[j])
			break


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	for k in range(2, 30):
		x = n / (2 ** k - 1)
		if float.is_integer(x):
			print(int(x))
			break


t = int(input())
num1 = []
for i in range(2, 103):
	num1.append(2 ** i - 1)
for i in range(t):
	n = int(input())
	for i in num1:
		if n % i == 0:
			print(n // i)
			break
		else:
			continue


def solve(n):
	coef = 3
	while n % coef != 0:
		coef = (coef + 1 << 1) - 1
	return n // coef
for i in range(int(input())):
	n = int(input())
	print(solve(n))


t = int(input())
for i in range(t):
	n = int(input())
	x = 3
	for k in range(2, 10 ** 10):
		if n % x == 0:
			print(n // x)
			break
		else:
			x += 2 ** k


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	for k in range(n):
		s += 2 ** k
		if not n % s and k > 0:
			print(n // s)
			break
		elif s >= n:
			break


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		k = 4
		for i in range(1, 33):
			p = k - 1
			if n % p == 0:
				break
			k *= 2
		print(n // (k - 1))
	return
main()


import sys, math, cmath, time
start_time = time.time()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	for i in range(2, 500):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
t = 1
t = inp()
for tt in range(t):
	solve()
if not ONLINE_JUDGE:
	print('Time Elapsed:', time.time() - start_time, 'seconds')
sys.stdout.close()


for t in range(int(input())):
	n = int(input())
	k = 1
	while True:
		k += 1
		x = n / (2 ** k - 1)
		if x == int(x):
			print(int(x))
			break


import sys

def func():
	n = int(sys.stdin.readline())
	k = 2
	while True:
		g = n % (2 ** k - 1)
		if g == 0:
			return n // (2 ** k - 1)
		else:
			k += 1
t = int(sys.stdin.readline())
while t:
	print(func())
	t -= 1


x = int(input())
for i in range(x):
	n = int(input())
	for j in range(2, 33):
		if n % (2 ** j - 1) == 0:
			print(int(n / (2 ** j - 1)))
			break
		else:
			continue


def solve(iteration):
	n = int(input())
	result = 0
	for k in range(3, 1000):
		if n % (2 ** (k - 1) - 1) == 0:
			result = n // (2 ** (k - 1) - 1)
			break
	print(result)
t = int(input())
for i in range(t):
	solve(i)


for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		(x, y) = divmod(n, 2 ** k - 1)
		if not y:
			print(x)
			break
		k += 1


(k, n, lst) = (3, 3, [])
while n <= 10000000000.0:
	lst.append(n)
	n += 2 ** (k - 1)
	k += 1
for t in range(int(input())):
	n = int(input())
	for i in lst:
		if n % i == 0:
			print(n // i)
			break
	else:
		print('Not found')


def bs(n):
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	res = n // (2 ** k - 1)
	return res
t = int(input())
for i in range(t):
	n = int(input())
	print(bs(n))


t = int(input())
while t > 0:
	n = int(input())
	k = 2
	r = 3
	while n - r >= 0:
		x = n / r
		if x == int(x):
			print(int(x))
			break
		k = k + 1
		r = 2 ** k - 1
	t = t - 1


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		n = Read.int()
		p = 3
		k = 4
		while True:
			if n % p == 0:
				print(n // p)
				break
			else:
				p += k
				k *= 2
main()


for _ in range(int(input())):
	n = int(input())
	ans = 0
	for i in range(2, 30):
		p = pow(2, i) - 1
		if n % p == 0:
			ans = n // p
			break
	print(ans)


for _ in range(int(input())):
	a = int(input())
	i = 3
	c = 4
	while a % i != 0:
		i += c
		c *= 2
	print(a // i)


for _ in range(int(input())):
	n = int(input())
	chk = True
	k = 2
	while chk:
		if n % (pow(2, k) - 1) == 0:
			print(n // (pow(2, k) - 1))
			chk = False
			break
		else:
			k += 1


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	k = 3
	c = 3
	while True:
		if n % k == 0:
			break
		k = 2 ** c - 1
		c = c + 1
	print(n // k)


from sys import stdin
n = int(input())
for i in range(n):
	end = False
	num = int(stdin.readline())
	for k in range(2, 30):
		if num % (2 ** k - 1) == 0:
			print(num // (2 ** k - 1))
			break


t = int(input())
for T in range(t):
	s = int(input())
	k = 2
	val = 0
	while True:
		val = s / (pow(2, k) - 1)
		if val == int(val):
			break
		k += 1
	print(int(val))


for _ in range(int(input())):
	n = int(input())
	c = n
	cc = 0
	while c > 1:
		c = c // 2
		cc += 1
	for i in range(2, cc + 4):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		d = 2 ** k - 1
		if n / d == n // d:
			print(n // d)
			break
		k += 1


t = int(input())
for _ in range(t):
	n = int(input())
	k = 3
	l = 0
	for y in range(n):
		x = n / k
		if x.is_integer():
			print(int(x))
			break
		k = 2 * k + 1


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	i = 2
	maxi = 10 ** 9
	while pow(2, i) - 1 < maxi:
		if n % (pow(2, i) - 1) == 0:
			print(n // (pow(2, i) - 1))
			break
		else:
			i += 1


from math import *
from collections import *
from itertools import *
from bisect import *
from heapq import *
from operator import *

def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	l = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911]
	for i in range(len(l)):
		if n % l[i] == 0:
			print(n // l[i])
			break


lim = 1000000000.0
a = []
(k, sum) = (1, 1)
while sum + pow(2, k) <= lim:
	sum += pow(2, k)
	a.append(sum)
	k += 1

def solve():
	n = int(input())
	for i in a:
		if n % i == 0:
			print(n // i)
			return
t = int(input())
for i in range(t):
	solve()


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	for k in range(2, 32):
		x = n / (2 ** k - 1)
		if x == int(x):
			ans.append(int(x))
			break
print(*ans, sep='\n')


t = int(input())
for _ in range(t):
	n = int(input())
	s = 1
	ans = -1
	i = 2
	while s <= n:
		s += pow(2, i - 1)
		if n % s == 0:
			ans = n // s
		i += 1
		if ans is not -1:
			break
	print(ans)


def main():
	tc = int(input())
	for _ in range(tc):
		n = int(input())
		s = 3
		i = 2
		while n % s:
			s += 2 ** i
			i += 1
		print(n // s)
main()


for i in range(int(input())):
	n = int(input())
	for k in range(2, 31):
		value = 2 ** k - 1
		if n % value == 0:
			print(n // value)
			break


for _ in range(int(input())):
	a = int(input())
	x = int(2)
	while 1 < 2:
		b = pow(2, x) - 1
		if a % b == 0:
			print(a // b)
			break
		x = x + 1


def ans(n):
	for k in range(2, 30):
		if n / (2 ** k - 1) == n // (2 ** k - 1):
			return n // (2 ** k - 1)
for _ in range(int(input())):
	n = int(input())
	print(ans(n))


t = int(input())
result = []
for i in range(t):
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	result.append(int(n / (2 ** k - 1)))
for r in result:
	print(r)


t = int(input())
list1 = []
for test_case in range(t):
	n = int(input())
	for k in range(1, 10000):
		x = n / (2 ** k - 1)
		if x % 1 != 0:
			k += 1
		elif x / n == 1:
			k += 1
		else:
			list1.append(x)
			break
for items in list1:
	print(int(items))


import math
t = int(input())
while t > 0:
	k = 2
	n = int(input())
	while k <= int(math.log2(n)) + 1:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		k += 1
	t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	tmp = math.log2(n + 1)
	flag = 0
	for p in range(2, int(tmp)):
		x = n / (2 ** p - 1)
		if float(x).is_integer():
			print(int(x))
			flag = 1
			break
	if not flag:
		print(int(n / (2 ** math.floor(tmp) - 1)))


from sys import stdin

def main():
	(pp, n) = ([], 2)
	for _ in range(30):
		n *= 2
		pp.append(n - 1)
	(_, *l) = map(int, stdin.read().split())
	for (i, n) in enumerate(l):
		for p in pp:
			if not n % p:
				l[i] = n // p
				break
	print('\n'.join(map(str, l)))
main()


T = int(input())
for _ in range(T):
	n = int(input())
	Sum = 1
	for i in range(1, 1000000000):
		Sum += 2 ** i
		if n % Sum == 0:
			print(n // Sum)
			break


t = int(input())
for case in range(t):
	n = int(input())
	x = 0
	den = 0
	for k in range(2, 36):
		den = pow(2, k) - 1
		if n % den:
			continue
		else:
			x = n // den
			break
	print(x)


t = int(input())
tmp = []
x = 1
sum_x = 1
for i in range(0, 32):
	x *= 2
	sum_x += x
	tmp.append(sum_x)
for i in range(0, t):
	n = int(input())
	for s in tmp:
		if n % s == 0:
			print(n // s)
			break


import math
t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 31):
		x = n / (2 ** k - 1)
		(p, q) = math.modf(x)
		if p > 0.0:
			pass
		else:
			print(int(x))
			break


t = int(input())
for i in range(t):
	n = int(input())
	b = True
	g = 3
	s = 2
	x = 0
	while b:
		if n % g == 0:
			x = n // g
			b = False
		else:
			g += 2 ** s
			s += 1
	print(x)


testcase = int(input())
for _ in range(0, testcase):
	n = int(input())
	x = 0
	k = 0
	for k in range(2, n):
		x = -n / (1 - 2 ** k)
		temp = str(x)
		if temp[-2] == '.':
			break
	print(int(x))


import sys
input = sys.stdin.readline
ans = []
t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			ans.append(n // (2 ** k - 1))
			break
		else:
			k += 1
for i in ans:
	print(i)


items = [3]
i = 3
while items[-1] < 10 ** 9:
	items.append(2 ** i - 1)
	i += 1
t = int(input())
for _ in range(t):
	n = int(input())
	flag = 0
	for item in items:
		if n % item == 0:
			print(n // item)
			flag = 1
			break


t = int(input())
if 1 <= t <= 10 ** 9:
	for temporary in range(t):
		n = int(input())
		unknown = 3
		for a in range(2, 10 ** 5):
			if n % unknown == 0:
				x = n / unknown
				print(int(x))
				break
			unknown = unknown * 2 + 1


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(n):
	p = 1
	for k in range(1, 30):
		p += 1 << k
		if n % p == 0:
			return n // p
t = iint()
for _ in range(t):
	n = iint()
	print(solve(n))


import math
for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		if n % (math.pow(2, k) - 1) == 0:
			break
		else:
			k = k + 1
	print(int(n / (math.pow(2, k) - 1)))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		k = 2
		while 2 ** k - 1 < n and n % (2 ** k - 1):
			k += 1
		print(n // (2 ** k - 1))
main()


test_case = int(input())
my_list = []
arr = []
for i in range(test_case):
	my_list.append(int(input()))
test = len(bin(max(my_list)))
total = 1
for j in range(test):
	total = total + 2 ** (j + 1)
	arr.append(total)
for x in range(test_case):
	for y in range(test):
		if my_list[x] % arr[y] == 0:
			print(int(my_list[x] / arr[y]))
			break


table = []
for i in range(2, 40):
	table.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	for j in range(0, 39):
		if n % table[j] == 0:
			print(n // table[j])
			break


def sol():
	t = int(input())
	for tt in range(t):
		n = int(input())
		for k in range(2, n):
			if n % (2 ** k - 1) == 0:
				print(int(n / (2 ** k - 1)))
				break
sol()


t = int(input())
pow2 = [0] * 28
val = 4
maxpow2 = 28
for k in range(maxpow2):
	pow2[k] = val - 1
	val = val * 2
for i in range(t):
	n = int(input())
	for j in pow2:
		x = n / j
		if x % 1 == 0:
			print(int(x))
			break


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def array():
	return [int(i) for i in input().split()]
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
l = list()
for i in range(2, 3000):
	l.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	ans = 1
	f = 0
	for i in l:
		if n % i == 0:
			break
	print(n // i)


t = int(input())
while t:
	n = int(input())
	for k in range(2, 1000000000):
		x = n / (2 ** k - 1)
		y = n // (2 ** k - 1)
		if x == y:
			print(int(x))
			break
	t -= 1


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for i in range(t):
	n = int(input())
	counter = 4
	while True:
		if n % (counter - 1) == 0:
			print(int(n / (counter - 1)))
			break
		counter *= 2


def r(t=int):
	return list(map(t, input().split()))

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(r()[0]):
	a = r()[0]
	(s, f) = (3, 4)
	while a % s:
		s += f
		f *= 2
	print(a // s)


for t in range(int(input())):
	n = int(input())
	b = '11'
	while n % int(b, 2):
		b += '1'
	print(n // int(b, 2))


arr = []
for i in range(61):
	arr.append(2 ** i)
for i in range(1, len(arr)):
	arr[i] = arr[i] + arr[i - 1]
arr = arr[1:]
for _ in range(int(input())):
	n = int(input())
	for i in arr:
		if n % i == 0:
			print(n // i)
			break


n = int(input())
while n > 0:
	n -= 1
	t = int(input())
	m = 4
	while 1:
		m -= 1
		if t % m == 0:
			break
		m += 1
		m *= 2
	print(int(t / m))


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 30):
		val = 2 ** k - 1
		if n % val == 0:
			x = n // val
			print(x)
			break


t = int(input())
for _ in range(t):
	k = int(input())
	for i in range(2, 50):
		if k % (2 ** i - 1) == 0:
			print(k // (2 ** i - 1))
			break


T = int(input())
for t in range(T):
	n = int(input())
	for i in range(2, 30):
		a = 2 ** i - 1
		if n % a == 0:
			print(n // a)
			break


def candies(num):
	i = 1
	k = 2
	while True:
		i = i + k
		if num % i == 0:
			return num // i
		k *= 2
t = int(input())
for i in range(t):
	n = int(input())
	print(candies(n))


t = int(input())
for q in range(t):
	n = int(input())
	soma = 3
	while n % soma != 0:
		soma += soma + 1
	print(n // soma)


t = int(input())
for i in range(t):
	n = int(input())
	j = 2
	s = 3
	while not n % s == 0:
		s += 2 ** j
		j += 1
	print(n // s)


t = int(input())
table = [1]
cur = 2
while cur <= 1000000000.0 + 10:
	table.append(table[-1] + cur)
	cur *= 2
for _ in range(t):
	n = int(input())
	for cand in table[1:]:
		if n % cand == 0:
			print(n // cand)
			break


import sys

def process(X):
	i = 1
	while 1:
		if X % (2 ** (i + 1) - 1) == 0:
			x = X // (2 ** (i + 1) - 1)
			print(x)
			return
		i += 1

def isPowerOfTwo(n):
	if n == 0:
		return False
	while n != 1:
		if n % 2 != 0:
			return False
		n = n // 2
	return True
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def f(a, n):
	return True

def is_permutation(arr):
	for e in range(1, len(arr) + 1):
		if e not in arr:
			return False
	return True
t = inp()
for i in range(t):
	n = inp()
	process(n)


import math
for _ in range(int(input())):
	n = int(input())
	s = 1
	for i in range(1, int(math.log2(n)) + 1):
		s = s + pow(2, i)
		if n % s == 0:
			print(n // s)
			break


t = int(input())
for it in range(t):
	n = int(input())
	k = 2
	gp_sum = -1 * (1 - 2 ** k)
	while n % gp_sum != 0:
		k += 1
		gp_sum = -1 * (1 - 2 ** k)
	print(n // gp_sum)


def read():
	return list(map(lambda x: int(x), input().split()))
t = read()[0]
for i in range(t):
	x = read()[0]
	for k in range(2, 40):
		if x % (2 ** k - 1) == 0:
			print(x // (2 ** k - 1))
			break


try:
	t = int(input())
	for test in range(t):
		n = int(input())
		k = 1
		while True:
			k = k + 1
			y = 2 ** k - 1
			if n % y == 0:
				print(int(n / y))
				break
except:
	pass


t = int(input())
AnsList = []

def findK(n):
	k = 2
	while 2 ** k - 1 < n + 1:
		if n % (2 ** k - 1) == 0:
			return k
		else:
			k += 1
for _ in range(t):
	n = int(input())
	k = findK(n)
	x = n // (2 ** k - 1)
	AnsList.append(x)
for x in AnsList:
	print(x)


for i in range(int(input())):
	n = int(input())
	if not n % 3:
		print(n // 3)
	else:
		s = 3
		x = 4
		while n % s:
			s += x
			x *= 2
		print(n // s)


test_case = int(input())
while test_case > 0:
	n = int(input())
	for k in range(2, n):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
	test_case -= 1


k = int(input())
while k > 0:
	n = int(input())
	for i in range(2, 30):
		p = 2 ** i
		p -= 1
		if n % p == 0:
			print(n // p)
			break
	k -= 1


for _ in range(int(input())):
	n = int(input())
	k = 3
	for i in range(2, 10 ** 5):
		if n % k == 0:
			x = n // k
			break
		k += 2 ** i
	print(x)


from math import log
for _ in range(int(input())):
	n = int(input())
	flag = 0
	k = 0
	while flag == 0:
		for i in range(2, 100):
			k = 2 ** i - 1
			if n % k == 0:
				print(int(n / k))
				flag = 1
				break
n


t = int(input())
for tc in range(t):
	n = int(input())
	for k in range(1, 31):
		s = (1 - 2 ** (k + 1)) // (1 - 2)
		if n % s == 0:
			print(n // s)
			break


for _ in range(int(input())):
	n = int(input())
	found = False
	coeff = 3
	ans = 0
	while not ans:
		if n % coeff == 0:
			ans = n // coeff
			break
		coeff *= 2
		coeff += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	i = 3
	b = 4
	while n % i != 0:
		i += b
		b *= 2
	print(n // i)


n = int(input())
for _ in range(n):
	a = int(input())
	s = 3
	ex = 1
	while a % s != 0:
		ex += 1
		s += pow(2, ex)
	print(a // s)


a = int(input())
for i in range(a):
	b = int(input())
	a = 3
	while b % a != 0:
		a = (a << 1) + 1
	print(b // a)


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 12

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def check(a, b):
	for i in range(26):
		for j in range(len(a) + 1):
			q = a[:j] + chr(97 + i) + a[j:]
			if q == b:
				return 1
	return 0

def solve(a):
	for k in range(2, 40):
		z = pow(2, k) - 1
		if a % z == 0:
			return a // z
for _ in range(inp()):
	a = inp()
	l = solve(a)
	print(l)


def geoSum(n):
	for i in range(2, 30):
		val = (1 << i) - 1
		if n % val == 0:
			return n // val
	return 0
for _ in range(int(input())):
	n = int(input())
	print(geoSum(n))


for _ in range(int(input())):
	n = int(input())
	for i in range(2, 99999999):
		d = 2 ** i - 1
		x = n / d
		if x % 1 == 0:
			print(int(x))
			break


n = int(input())
for i in range(n):
	a = int(input())
	m = 0
	g = 1
	h = 2
	for i in range(a):
		if a % g == 0 and g > m and (g != 1):
			m = g
			break
		g = g + h
		h = h + h
	print(int(a / m))


for i in range(int(input())):
	pow2 = 4
	n = int(input())
	while pow2 - 1 <= n:
		if n % (pow2 - 1) == 0:
			print(n // (pow2 - 1))
			break
		pow2 *= 2


import sys
Lines = []
for Line in sys.stdin:
	Lines.append(Line.rstrip('\n'))
t = int(Lines[0])
del Lines[0]

def which(m, n):
	d = 2
	x = int('1' * d, 2)
	while m > d and n / x != round(n / x):
		d = d + 1
		x = int('1' * d, 2)
	return n // x
for i in range(t):
	n = int(Lines[i])
	x = bin(n)[2:]
	print(which(len(x), n))


T = int(input())
store = [4]
for k in range(1, 50):
	store.append(store[-1] * 2)
store = [i - 1 for i in store if i <= 10 ** 9 + 1]
for t in range(T):
	n = int(input())
	for j in range(len(store)):
		if n % store[j] == 0:
			x = n // store[j]
			print(x)
			break


def sol():
	n = int(input())
	ans = 0
	na = 4
	i = 0
	while True:
		if n % (na - 1) == 0:
			return n // (na - 1)
			break
		na = na * 2
		i += 1
for _ in range(int(input())):
	print(sol())


pre = [2 ** i - 1 for i in range(2, 30)]
t = int(input())
for i in range(t):
	n = int(input())
	for d in pre:
		if n % d == 0:
			print(n // d)
			break


import math
num_case = int(input())
for i in range(num_case):
	k = int(input())
	test = int(math.log2(k))
	for i in range(2, test + 2):
		if k % (2 ** i - 1) == 0:
			print(int(k / (2 ** i - 1)))
			break


t = int(input())
while t > 0:
	a = int(input())
	for i in range(2, 36):
		den = 2 ** i - 1
		if a % den:
			continue
		x = a // den
		break
	print(x)
	t -= 1


for t in range(int(input())):
	n = int(input())
	for k in range(2, 10 ** 9):
		term = 2 ** k - 1
		if n % term == 0:
			print(int(n / term))
			break


a = int(input())
for _ in range(a):
	g = 4
	v = 3
	t = 0
	n = int(input())
	while t == 0:
		if n % v != 0:
			v += g
			g *= 2
		else:
			t = 1
	print(n // v)


t = int(input())
for i in range(t):
	n = int(input())
	a = 1
	for k in range(2, 30):
		a = n / ((1 << k) - 1)
		if a == int(a):
			break
	print(int(a))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	while 1 > 0:
		z = 2 ** i - 1
		if n % z == 0:
			print(n // z)
			break
		else:
			i += 1


for _ in range(int(input())):
	n = int(input())
	for i in range(2, 32):
		r = (1 << i) - 1
		if n % r == 0:
			print(n // r)
			break
	else:
		print(n)


n = int(input())
squares = []
for i in range(2, 31):
	squares.append(2 ** i - 1)
for i in range(n):
	tmp = int(input())
	for sq in squares:
		if tmp % sq == 0:
			print(int(tmp / sq))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, 100000000):
		y = n / (2 ** i - 1)
		if int(y) == y:
			print(int(y))
			break


t = int(input())
for i in range(t):
	n = int(input())
	i = 4
	cnt = 3
	while n % cnt != 0:
		cnt += i
		i *= 2
	print(n // cnt)


def main():
	t = int(input())
	while t:
		try:
			n = int(input())
		except EOFError:
			break
		for k in range(2, int(100000000.0)):
			p = pow(2, k) - 1
			if n % p == 0:
				print(n // p)
				break
main()


import math
t = int(input())
lista = []
for i in range(t):
	num = int(input())
	x = 1
	y = 1
	while True:
		if num % (x + 2 ** y) == 0:
			break
		x += 2 ** y
		y += 1
	lista.append(num // (x + 2 ** y))
for i in lista:
	print(i)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict
sys.setrecursionlimit(300000)

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24
temp = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, 4294967295, 8589934591, 17179869183, 34359738367, 68719476735, 137438953471, 274877906943, 549755813887]

def solve():
	n = N()
	for i in temp:
		if n % i == 0:
			print(n // i)
			return
testcase(int(inp()))


ans = []
for _ in range(int(input())):
	n = int(input())
	pw = 2
	while pw < n:
		pw *= 2
		if n % (pw - 1) == 0:
			ans.append(n // (pw - 1))
			break
print('\n'.join(map(str, ans)))


for i in range(int(input())):
	n = int(input())
	k = 2
	while True:
		mn = n / ((1 << k) - 1)
		if int(mn) == mn:
			print(int(mn))
			break
		k += 1


from sys import stdin
input = stdin.readline

def A():
	li = []
	for i in range(2, 30):
		li.append(2 ** i - 1)
	for _ in range(int(input())):
		n = int(input())
		j = 0
		while j < len(li):
			if n % li[j] == 0:
				print(n // li[j])
				break
			j += 1
	return

def B():
	return

def C():
	return

def D():
	return

def E():
	return
A()


for test in range(int(input())):
	n = int(input())
	for k in range(2, 100):
		if n % (pow(2, k) - 1) == 0:
			print(n // (pow(2, k) - 1))
			break


t = int(input())
for i in range(t):
	n = int(input())
	x = 0
	for i in range(2, 32):
		if n % (pow(2, i) - 1) == 0:
			x = n // (pow(2, i) - 1)
			break
	print(x)


tc = int(input())
candies = []
for _ in range(tc):
	candies.append(int(input()))
for n in candies:
	x_not_found = True
	while x_not_found:
		for k in range(2, 30):
			x = n / (2 ** k - 1)
			if int(x) == x:
				print(int(x))
				x_not_found = False
				break


for i in range(int(input())):
	n = int(input())
	x = 3
	y = 2
	while n % x != 0:
		y = y * 2
		x = x + y
	print(int(n / x))


for _ in range(int(input())):
	n = int(input())
	div = 3
	j = 2
	while True:
		if n % div == 0:
			print(int(n / div))
			break
		else:
			j = j * 2
			div = div + j


import collections
t = int(input())
for ii in range(t):
	n = int(input())
	q = 3
	temp = 2
	while n % q != 0:
		temp = temp * 2
		q += temp
	print(n // q)


for i in range(int(input())):
	num = int(input())
	s = 3
	i = 1
	while num % s != 0:
		i += 1
		s += pow(2, i)
	print(num // s)


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(2, 100):
		x = pow(2, j) - 1
		if n % x == 0:
			print(n // x)
			break


for _ in range(int(input())):
	value = 2
	n = int(input())
	c = 0
	while c == 0:
		if n % (value * 2 - 1) == 0:
			print(n // (value * 2 - 1))
			c = 1
		else:
			value = value * 2


t = int(input())
for i in range(t):
	n = int(input())
	l = [3, 7, 15]
	while n > l[len(l) - 1]:
		k = int(l[len(l) - 1] * 2) + 1
		l.append(k)
	for j in l:
		if n % int(j) == 0:
			print(int(n / j))
			break


t = int(input())
for i in range(0, t):
	n = int(input())
	k = 4
	temp = 0
	while temp == 0:
		if n % (k - 1) == 0:
			print(int(n // (k - 1)))
			temp = 1
		k *= 2


import sys

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		for k in range(2, 50):
			if n % (2 ** k - 1) == 0:
				print(n // (2 ** k - 1))
				break
main()


tests = input()
k = []
for i in range(0, int(tests)):
	n_aux = int(input())
	kterm = 0
	sol = -1
	eqn = 0
	while True:
		eqn += pow(2, kterm)
		sol = n_aux / eqn
		if float(sol).is_integer() and kterm > 0:
			k += [sol]
			break
		kterm += 1
for i in k:
	print(int(i))


import math
t = int(input())
inpt = []
for i in range(t):
	inpt.append(int(input()))
for i in inpt:
	k = 2
	x = 0
	while x == 0:
		denominator = math.pow(2, k) - 1
		if i % denominator == 0:
			print(int(i / denominator))
			x = 1
		k += 1


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	while 1:
		if n % (2 ** k - 1) == 0:
			print(round(n / (2 ** k - 1)))
			break
		k = k + 1


import math
from sys import stdin, stdout
T = int(input())
for i in range(T):
	N = int(input())
	res = -1
	flg = 0
	bound = int(math.ceil(math.log(N, 2)))
	for k in range(2, bound + 1, 1):
		if math.floor(N / (2 ** k - 1)) == math.ceil(N / (2 ** k - 1)):
			print(math.floor(N / (2 ** k - 1)))
			flg = 1
			break
	if not flg:
		print(str(res))


for __ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		k += 1


def foo(n):
	k = 2
	while k < 100000:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			return
		k += 1
t = int(input())
for i in range(t):
	n = int(input())
	foo(n)


from sys import stdin, stdout
for query in range(int(stdin.readline())):
	x = int(stdin.readline())
	for y in range(2, 100):
		if x / (2 ** y - 1) == x // (2 ** y - 1):
			stdout.write(str(x // (2 ** y - 1)) + '\n')
			break


import sys
import math
n = int(input())
for i in range(n):
	t = int(input())
	j = 2
	f = 0
	while f != 1:
		if t % (int(math.pow(2, j)) - 1) == 0:
			print(t // int(math.pow(2, j) - 1))
			f = 1
			break
		j += 1


import math as m
test_cases = int(input())
cases = []
while test_cases > 0:
	n = int(input())
	cases.append(n)
	test_cases -= 1
for n in cases:
	ma = False
	for k in range(2, 30):
		res = n / (2 ** k - 1)
		if res == m.floor(res):
			ma = True
			print(int(res))
			break
	if ma == False:
		print('1')


for i in range(int(input())):
	n = int(input())
	x = 3
	while n % x:
		x = x * 2 + 1
	print(n // x)


import math
t = int(input())
while t:
	n = int(input())
	for i in range(2, n + 1):
		if math.floor(n / (2 ** i - 1)) == math.ceil(n / (2 ** i - 1)):
			print(int(n / (2 ** i - 1)))
			break
	t -= 1


for _ in range(int(input())):
	n = int(input())
	dp = []
	i = 4
	while i < 1000000000:
		dp.append(i - 1)
		i *= 2
	for i in dp:
		if n % i == 0:
			print(n // i)
			break


k = [1]
for t in range(40):
	k.append(2 * k[-1])
for _ in range(int(input())):
	n = int(input())
	s = 1
	for t in k[1:]:
		s += t
		if n % s == 0:
			print(n // s)
			break


n = int(input())
while n > 0:
	a = int(input())
	tmp = 3
	i = 2
	while a % tmp != 0 and tmp <= a:
		i = i * 2
		tmp += i
	print(int(a / tmp))
	n -= 1


def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		found = False
		p = 4
		while not found:
			if n % (p - 1) == 0:
				print(n // (p - 1))
				break
			else:
				p *= 2
main()


def find_value(n):
	(tmp, k) = (3, 2)
	while n % tmp != 0:
		k += 1
		tmp += 2 ** (k - 1)
	return int(n / tmp)
t = int(input())
for i in range(t):
	n = int(input())
	print(find_value(n))


t = int(input())
gp = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823]
for test in range(t):
	n = int(input())
	x = 1
	summm = 0
	for i in gp:
		if n % i == 0:
			print(n // i)
			break


t = int(input())
a = [pow(2, k) - 1 for k in range(2, 35)]
for _ in range(t):
	n = int(input())
	for i in range(len(a)):
		if n % a[i] == 0:
			print(n // a[i])
			break


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	for k in range(2, n):
		if not n % (2 ** k - 1):
			res.append(n / (2 ** k - 1))
			break
for r in res:
	print(int(r))


import math

def dhana(n):
	k = 2
	while k > 1:
		x = n / (2 ** k - 1)
		if x - math.ceil(x) == 0:
			a = int(x)
			return a
			break
		k += 1
z = int(input())
for i in range(z):
	n = int(input())
	x = dhana(n)
	print(x)


for _ in range(int(input())):
	number = int(input())
	x = 4
	total = 3
	while number % total != 0:
		total += x
		x <<= 1
	print(number // total)


x = int(input())
for i in range(x):
	y = int(input())
	for a in range(2, 30):
		if y % (2 ** a - 1) == 0:
			print(int(y / (2 ** a - 1)))
			break


T = int(input())
while T:
	T -= 1
	N = int(input())
	k = 2
	while True:
		x = N / (2 ** k - 1)
		if x == int(x):
			print(int(x))
			break
		k += 1


t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	while 1:
		c = pow(2, k) - 1
		if n // c == n / c:
			x = n // c
			break
		k += 1
	print(x)


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()
t = iint()
for _x in range(t):
	n = iint()
	for k in range(2, 200):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for i in range(inin()):
	n = inin()
	temp = 3
	while n % temp > 0:
		temp = temp * 2 + 1
	print(n // temp)


from math import *
for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3)
	elif n % 7 == 0:
		print(n // 7)
	elif n % 31 == 0:
		print(n // 31)
	elif n % 127 == 0:
		print(n // 127)
	elif n % 8191 == 0:
		print(n // 8191)
	elif n % 131071 == 0:
		print(n // 131071)
	elif n % 524287 == 0:
		print(n // 524287)
	elif n % 23 == 0 and n % 8388607 != 0 and (n % 536870911 != 0):
		print(n // 2047)
	elif n % 47 == 0 and n % 536870911 != 0:
		print(n // 8388607)
	elif n % 233 == 0:
		print(n // 536870911)


t = int(input())
for _ in range(t):
	n = int(input())
	f = 0
	i = 1
	while f < 1:
		if n % (2 ** (i + 1) - 1) == 0:
			x = 2 ** (i + 1) - 1
			print(int(n / x))
			f = 2
		else:
			i += 1


import math
t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, int(math.log(n + 1, 2) + 10)):
		if n % (2 ** i - 1) == 0:
			x = n // (2 ** i - 1)
			break
	print(x)


import math
a = []
for i in range(2, 30):
	a.append(2 ** i - 1)
for _ in range(int(input())):
	n = int(input())
	for k in a:
		if n % k == 0:
			print(n // k)
			break


t = int(input())
while t:
	t -= 1
	n = int(input())
	k = 3
	i = 3
	while True:
		x = n / k
		if x == int(x):
			print(int(x))
			break
		else:
			k += 2 ** (i - 1)
			i += 1


n = int(input())
for q in range(n):
	a = int(input())
	k = 2
	flag = 0
	while 2 ** k - 1 < a:
		if a % (2 ** k - 1) == 0:
			print(a // (2 ** k - 1))
			flag = 1
			break
		else:
			k += 1
	if flag == 0:
		print(1)


import math
m = int(input())
while m:
	n = int(input())
	l1 = [int(n // (math.pow(2, i) - 1)) for i in range(2, 40) if n % (math.pow(2, i) - 1) == 0]
	print(l1[0])
	m = m - 1


from math import log2
T = int(input())
for case in range(T):
	N = int(input())
	k = 1
	while 1:
		k += 1
		d = 2 ** k - 1
		if N / d == int(N / d):
			break
	print(int(N / d))


t = int(input())
for rep in range(t):
	n = int(input())
	ans = 4
	while True:
		if n % (ans - 1) == 0:
			print(n // (ans - 1))
			break
		ans *= 2


t = int(input())
for _ in range(t):
	n = int(input())
	num = 3
	ans = 0
	for i in range(30):
		if n / num % 1 == 0:
			ans = int(n / num)
			break
		else:
			num = num + (1 << i + 2)
	print(ans)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


t = int(input())
import math
for _ in range(t):
	n = int(input())
	for k in range(2, math.floor(math.log2(n + 1)) + 1):
		x = n / (2 ** k - 1)
		if x % 1 == 0:
			print(int(x))
			break


t = int(input())
for i in range(0, t):
	n = int(input())
	k = 2
	x = n / (2 ** k - 1) * 1.0
	x2 = int(n / (2 ** k - 1))
	while x != x2:
		x = n / (2 ** k - 1) * 1.0
		x2 = int(n / (2 ** k - 1))
		k = k + 1
	print(x2)


T = int(input())
for xx in range(T):
	n = int(input())
	k = 2
	while n % (pow(2, k) - 1) != 0:
		k += 1
	print(n // (pow(2, k) - 1))


T = int(input())
while T != 0:
	T = T - 1
	n = int(input())
	for i in range(2, 32):
		j = 2 ** i - 1
		if n % j == 0:
			break
	print(n // j)


import math
import sys
msg = sys.stdin.read()
l = list(map(int, msg.split()))
l = l[1:]
primes2 = [2, 3]
mark = 5
while primes2[-1] < 31633:
	mxc = math.ceil(mark ** 0.5)
	mark_p = False
	while not mark_p:
		mark_p = True
		for i in primes2:
			if mark % i == 0:
				mark_p = False
			if i > mxc:
				break
		if not mark_p:
			mark += 2
	primes2.append(mark)
	mark += 2

def is_int(n):
	if n % 1 == 0:
		return True
	else:
		return False

def candy(n):
	for x in range(1, n):
		if is_int(n / x):
			a = math.log(n / x + 1, 2)
			if is_int(a):
				return x
				break

def acandy(n):
	flag = False
	k = 2
	while not flag:
		a = 2 ** k - 1
		k += 1
		if n % a == 0:
			return n / a
			break
for i in l:
	print(int(acandy(i)))


def osobie_del(n):
	B = []
	k = 4
	while k <= n + 1:
		B.append(k - 1)
		k = k * 2
	return B
t = int(input())
for j in range(t):
	n = int(input())
	B = [*osobie_del(n)]
	for i in range(len(B)):
		if n % B[i] == 0:
			print(n // B[i])
			break


from math import pow

def f(n):
	divisor = 1
	k = 1
	while True:
		x = n / divisor
		divisor += pow(2, k)
		if n % x == 0 and k > 1:
			return int(x)
		k += 1
for i in range(int(input())):
	n = int(input())
	print(f(n))


import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		max_k = math.ceil(math.log2(n))
		for k in range(2, max_k + 1):
			temp = 2 ** k - 1
			if n % temp == 0:
				print(n // temp)
				break
main()


def solve():
	n = int(input())
	s = 1 + 2
	last = 2
	for i in range(2, 32):
		if n % s == 0:
			print(n // s)
			return
		last *= 2
		s += last
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	sum = 1
	for i in range(2, n + 1):
		sum += pow(2, i - 1)
		if n % sum == 0:
			print(n // sum)
			break


inp = list(map(int, input().split()))
t = inp[0]
for i in range(t):
	inp = list(map(int, input().split()))
	n = inp[0]
	k = 2
	while True:
		x = n / (2 ** k - 1)
		if x % 1 == 0:
			print(int(x))
			break
		k += 1


test = int(input())
while test > 0:
	n = int(input())
	count = 3
	i = 2
	while n % count != 0:
		count = count + pow(2, i)
		i += 1
	ans = n // count
	print(ans)
	test = test - 1


import math
for _ in range(int(input())):
	n = int(input())
	l = []
	p = int(math.log(n + 1, 10) / math.log(2, 10))
	for i in range(1, p + 1):
		v = n / int(pow(2, i) - 1)
		if int(v) == v:
			l.append(v)
	print(int(l[1]))


import math

def solve(n):
	k = 2
	while True:
		m = n / (2 ** k - 1)
		if m > 0 and m - int(m) == 0:
			return int(m)
			break
		k += 1
t = int(input())
A = []
for i in range(t):
	n = int(input())
	A.append(n)
for i in A:
	print(solve(i))


p = int(input())
while p > 0:
	p = p - 1
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			print(int(n / (2 ** k - 1)))
			break
		else:
			k += 1


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		n = int(input())
		p = 2
		val = 3
		while True:
			if n % val == 0:
				print(n // val)
				break
			val += pow(2, p)
			p += 1
main()


dp = []
x = 2
while x <= 10 ** 9:
	x *= 2
	dp.append(x - 1)
for _ in range(int(input())):
	n = int(input())
	for y in dp:
		if n % y == 0:
			print(n // y)
			break


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
for i in l:
	ans = 1
	k = 2
	a = 1
	while ans != 0:
		a += pow(2, k - 1)
		if i % a == 0:
			print(i // a)
			ans = 0
		k += 1


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		k = 2
		while n % (2 ** k - 1) != 0:
			k = k + 1
		print(n // (2 ** k - 1))
main()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		m = 2
		d = 3
		while n % d != 0:
			m *= 2
			d += m
		print(n // d)
	q = int(input())
	for _ in range(q):
		solve()
main()


q = int(input())
for _ in range(q):
	n = int(input())
	sm = 3
	i = 2
	while n / sm != int(n / sm):
		sm += 2 ** i
		i += 1
	print(int(n / sm))


t = int(input())
a = [2 ** i - 1 for i in range(2, 100)]
for i in range(t):
	p = int(input())
	for x in range(100):
		if p % a[x] == 0:
			print(int(p / a[x]))
			break


for _ in range(int(input())):
	n = int(input())
	for k in range(2, n):
		x = n / (2 ** k - 1)
		if x.is_integer():
			break
	print(int(x))


def f():
	T = int(input())
	for _ in range(T):
		n = int(input())
		for k in range(2, 30):
			divider = 2 ** k - 1
			if n % divider == 0:
				result = n // divider
				print(result)
				break
f()


try:
	t = int(input())
	while t:
		n = int(input())
		k = 2
		while True:
			r = 2 ** k - 1
			if n % r == 0:
				print(n // r)
				break
			k += 1
		t -= 1
except:
	pass


t = int(input())
k = 2
while t > 0:
	n = int(input())
	while True:
		if n % (pow(2, k) - 1) != 0:
			k += 1
		elif n % (pow(2, k) - 1) == 0:
			print(n // (pow(2, k) - 1))
			break
	k = 2
	t -= 1


import math
n = int(input())
for i in range(n):
	k = int(input())
	a = 1
	ans = 3
	t = 2
	while ans < k:
		if k % ans == 0:
			a = k / ans
			break
		else:
			t *= 2
			ans += t
	print(int(a))


def function(n):
	s = 3
	i = 3
	while n % s != 0 and n > s:
		s = 2 ** i - 1
		i += 1
	if n % s != 0:
		return 1
	return int(n // s)
t = int(input())
while t > 0:
	print(function(int(input())))
	t -= 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	while n % (math.pow(2, k) - 1) != 0:
		k = k + 1
	print(int(n / (math.pow(2, k) - 1)))


ans = []
for i in range(int(input())):
	n = int(input())
	k = 2
	while True:
		mod = n % (2 ** k - 1)
		if mod == 0:
			ans.append(n / (2 ** k - 1))
			break
		else:
			k += 1
ans = list(map(int, ans))
for _ in ans:
	print(_)


import math
t = int(input())
for i in range(t):
	n = int(input())
	num = math.log(n, 2)
	if math.floor(num) == math.ceil(num):
		print(n)
	else:
		a = int(num)
		if n == 2 ** (a + 1) - 1:
			print(1)
		else:
			for j in range(2, a + 1):
				b = 2 ** j - 1
				if n % b == 0:
					print(n // b)
					break


t = int(input())
n = [int(input()) for x in range(t)]
ans = []
for x in range(t):
	valN = n[x]
	k = 2
	sum = 3
	while not (valN / sum).is_integer():
		k += 1
		sum += pow(2, k - 1)
	ans.append(int(valN / sum))
for x in range(t):
	print(ans[x])


for i in range(int(input())):
	n = int(input())
	for k in range(2, 61):
		f = n / ((1 << k) - 1)
		if f.is_integer():
			print(int(f))
			break


t = int(input())
while t > 0:
	n = int(input())
	for k in range(2, 35):
		v = n
		w = 2 ** k - 1
		if v % w == 0:
			print(v // w)
			break
	t -= 1


def read():
	return list(map(int, input().strip().split()))

def read():
	return list(map(int, input().strip().split()))
arr = [0] * 101
arr[0] = 1
for i in range(1, 100):
	arr[i] = arr[i - 1] + 2 ** i
for t in range(int(input())):
	n = int(input())
	for i in arr[1:]:
		if i > n:
			break
		if n % i == 0:
			print(n // i)
			break


t = int(input())
ans = []
for a in range(t):
	n = int(input())
	sum = 0
	for k in range(1, n):
		sum = sum + 2 ** (k - 1)
		if sum == 1:
			pass
		elif n % sum == 0:
			x = n // sum
			ans.append(x)
			break
for j in ans:
	print(j)


n = int(input())
for i in range(n):
	a = int(input())
	b = 3
	c = 3
	while a % b != 0:
		b = pow(2, c) - 1
		c = c + 1
	print(int(a / b))


t = int(input())
for ti in range(t):
	n = int(input())
	start_i = 3
	x = 4
	while n % start_i != 0:
		start_i += x
		x *= 2
	print(n // start_i)


a = []
q = 1
q1 = 1
for i in range(10000):
	q1 *= 2
	q += q1
	a.append(q)
t = int(input())
for i in range(t):
	n = int(input())
	i1 = 0
	while n % a[i1] != 0:
		i1 += 1
	print(n // a[i1])


import sys
input = sys.stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		n = int(input())
		k = 4
		while True:
			if n % (k - 1) == 0:
				print(n // (k - 1))
				break
			k *= 2
main()


power2 = [1]
po = 1
for i in range(29):
	po = 2 * po
	power2.append(po + power2[i])
for _ in range(int(input())):
	n = int(input())
	for i in range(1, 31):
		if n % power2[i] == 0:
			print(int(n / power2[i]))
			break


t = int(input())
l = []
p = 2
for _ in range(50):
	p *= 2
	l.append(p - 1)
for _ in range(t):
	n = int(input())
	for li in l:
		if n % li == 0:
			print(n // li)
			break


import math
T = int(input())
for t in range(T):
	n = int(input())
	for i in range(2, n):
		if n % (2 ** i - 1) == 0:
			print(int(n / (2 ** i - 1)))
			break


for i in range(int(input())):
	t = int(input())
	s = 3
	i = 1
	ans = 0
	while s <= t:
		if t % s == 0:
			ans = t // s
			break
		else:
			i += 1
			s += 2 ** i
	print(ans)


x = int(input())
for num in range(x):
	y = int(input())
	count = 3
	count1 = 2
	while y % count != 0:
		count += 2 ** count1
		count1 += 1
	print(int(y / count))


def fun(a):
	for i in range(2, 30):
		if a / (2 ** i - 1) == a // (2 ** i - 1):
			print(a // (2 ** i - 1))
			break
t = int(input())
for _ in range(t):
	i = int(input())
	fun(i)


import math
for t in range(int(input())):
	sn = int(input())
	for n in range(2, 100):
		if (-sn / (1 - 2 ** n)).is_integer() == True:
			print(-sn // (1 - 2 ** n))
			break


t = int(input())
while t > 0:
	n = int(input())
	p = 0
	sum = 1
	flag = 1
	while n >= sum:
		if sum == n:
			print(1)
			flag = 0
			break
		p += 1
		sum += 2 ** p
		if n % sum == 0:
			print(n // sum)
			flag = 0
			break
	if flag == 1:
		p -= 1
		sum -= 2 ** p
		print(n // p)
	t -= 1


for i in range(int(input())):
	s = 1
	a = int(input())
	for j in range(1, a):
		s = s + 2 ** j
		if a % s == 0:
			print(a // s)
			break


for _ in range(int(input())):
	n = int(input())
	ok = 3
	i = 2
	while True:
		if n % ok == 0:
			print(n // ok)
			break
		ok += 2 ** i
		i += 1


x = input()
for _ in range(int(x)):
	a = int(input())
	tempa = 1
	for x in range(2, a):
		if a % (pow(2, x) - 1) == 0:
			print(a // (pow(2, x) - 1))
			break


for t in range(int(input())):
	n = int(input())
	for k in range(2, n):
		a = 2 ** k - 1
		if n % a == 0:
			print(n // a)
			break


k = int(input())
for kk in range(0, k):
	n = int(input())
	acc = 2
	i = 1
	while True:
		acc = acc * 2
		if n % (acc - 1) == 0:
			print(int(n / (acc - 1)))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 32):
		temp = (1 << k) - 1
		if n % temp == 0:
			print(n // temp)
			break


from pprint import pprint
import sys
input = sys.stdin.readline
import math
q = int(input())
for _ in range(q):
	x = 1
	n = int(input())
	for i in range(100):
		x = (x << 1) + 1
		if n % x == 0:
			print(n // x)
			break


t = int(input())
while t > 0:
	n = int(input())
	divisor = 3
	potencia = 4
	while n % divisor != 0:
		divisor = divisor + potencia
		potencia = potencia * 2
	print(n // divisor)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(2, 1000000000):
		c = pow(2, j) - 1
		if n % c == 0:
			print(n // c)
			break


for _ in range(int(input())):
	a = int(input())
	i = 2
	while 1:
		b = 2 ** i - 1
		if a % b == 0:
			print(int(a / b))
			break
		else:
			i += 1


t = int(input())
while t > 0:
	n = int(input())
	x = [1, 2]
	k = 2
	s = sum(x)
	while n % s != 0:
		x.append(2 ** k)
		k += 1
		s = sum(x)
	print(n // s)
	t -= 1


import math
test = int(input())
while test:
	n = int(input())
	s = 1
	k = 1
	while True:
		s += 2 ** k
		if math.modf(n / s)[0] == 0:
			x = n / s
			break
		k += 1
	print(int(x))
	test -= 1


for _ in range(int(input())):
	a = int(input())
	x = 3
	while True:
		if a % x == 0:
			print(int(a / x))
			break
		x *= 2
		x += 1


for t in range(int(input())):
	n = int(input())
	k = 2
	done = False
	while not done:
		if n % (2 ** k - 1) == 0:
			done = True
			print(n // (2 ** k - 1))
		else:
			k += 1


t = int(input())
for i in range(t):
	n = int(input())
	temp = 1
	for j in range(1, n):
		temp = temp + 2 ** j
		if n / temp == float(n // temp):
			print(n // temp)
			break


fix = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823]
for x in range(int(input())):
	inp = int(input())
	if inp in fix:
		print(1)
	else:
		for y in range(len(fix)):
			if inp % fix[y] == 0:
				print(int(inp / fix[y]))
				break


tc = int(input())
for t in range(tc):
	n = int(input())
	for k in range(2, n):
		x = 2 ** k - 1
		if n / x - n // x == 0:
			print(n // x)
			break


for test in range(int(input())):
	n = int(input())
	k = 2
	val = (1 << k) - 1
	while val <= n:
		if n % val == 0:
			print(int(n / val))
			break
		k += 1
		val = (1 << k) - 1


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 40):
		if n // (2 ** k - 1) == n / (2 ** k - 1):
			print(str(n // (2 ** k - 1)) + '\n')
			break


for i in range(int(input())):
	a = int(input())
	j = 3
	while j <= 1000000001:
		if a % j == 0:
			print(a // j)
			break
		j = j * 2 + 1


gooddivisors = [0] * 30
ithpowerof2 = 2
for i in range(30):
	ithpowerof2 = ithpowerof2 * 2
	gooddivisors[i] = ithpowerof2 - 1
numCases = int(input())
for _ in range(numCases):
	n = int(input())
	for divisor in gooddivisors:
		if n % divisor == 0:
			print(n // divisor)
			break


n = int(input())
for _ in range(n):
	a = int(input())
	dziel = 3
	while a % dziel != 0:
		dziel = dziel * 2 + 1
	print(int(a / dziel))


for _ in range(int(input())):
	n = int(input())
	pp = 3
	while n % pp != 0:
		pp = pp << 1
		pp |= 1
	print(n // pp)


t = int(input())
for _ in range(t):
	n = int(input())
	d = 3
	while n % d:
		d = d * 2 + 1
	print(n // d)


t = int(input())
for i in range(t):
	n = int(input())
	mod = 0
	x = 3
	while mod != 1:
		if n % x == 0:
			ans = n // x
			mod = 1
		else:
			x = 2 * x + 1
	print(ans)


def main():
	input1 = int(input())
	ns = []
	for i in range(input1):
		n = int(input())
		ns.append(n)
	for n in ns:
		coefficient = 3
		k = 2
		while n % coefficient != 0:
			k += 1
			coefficient += 2 ** (k - 1)
		x = int(n / coefficient)
		print(x)
main()


t = int(input())
for _ in range(t):
	k = int(input())
	i = 3
	while True:
		if k % i == 0:
			print(int(k / i))
			break
		else:
			i = 2 * i + 1


import math
for _ in range(int(input())):
	n = int(input())
	for i in range(2, 30):
		d = 2 ** i - 1
		if n / d == math.floor(n / d):
			print(int(n / d))
			break


import math
t = input()
t = int(t)
while t:
	t -= 1
	n = input()
	n = int(n)
	r = math.log2(n)
	r = math.ceil(r)
	ans = -1
	for i in range(2, r + 1):
		den = math.pow(2, i) - 1
		den = int(den)
		if n % den == 0:
			ans = n // den
			break
	print(ans)


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	c = 1
	for i in range(1, n):
		c += 2 ** i
		if n % c == 0:
			print(n // c)
			break


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
tests = inp()
testcount = 0
while testcount < tests:
	n = inp()
	i = 3
	while i <= n:
		if n % i == 0:
			print(int(n // i))
			i += n
		else:
			i *= 2
			i += 1
	testcount += 1


for t in range(int(input())):
	n = int(input())
	k = 2
	s = 3
	while n % s:
		s += 2 ** k
		k += 1
	print(int(n / s))


a = [2 ** x for x in range(31)]
for _ in range(int(input())):
	n = int(input())
	x = 0
	s = 0
	for i in range(len(a)):
		s += a[i]
		fx = n / s
		if int(fx) == fx and i > 0:
			x = fx
			break
	print(int(x))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if math.log2(n + 1).is_integer() == True:
		print(1)
	elif (n / 3).is_integer() == True:
		print(n // 3)
	elif (n / 7).is_integer() == True:
		print(n // 7)
	elif (n / 31).is_integer() == True:
		print(n // 31)
	elif (n / 127).is_integer() == True:
		print(n // 127)
	elif (n / 2047).is_integer() == True:
		print(n // 2047)
	elif (n / 8191).is_integer() == True:
		print(n // 8191)
	elif (n / 131071).is_integer() == True:
		print(n // 131071)
	elif (n / 524287).is_integer() == True:
		print(n // 524287)
	elif (n / 8388607).is_integer() == True:
		print(n // 8388607)
	elif (n / 536870911).is_integer() == True:
		print(n // 536870911)


a = int(input())
for x in range(a):
	b = int(input())
	k = 3
	while True:
		if b % k == 0:
			print(int(b / k))
			break
		else:
			k = 2 * k + 1


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for _ in range(t):
	n = int(inp().strip())
	divide = 3
	count = 2
	while True:
		if n % divide == 0:
			print(n // divide)
			break
		divide += 2 ** count
		count += 1


t = int(input())
for _ in range(t):
	n = int(input())
	c = 1 + 2
	m = 4
	while n % c != 0:
		c += m
		m *= 2
	print(n // c)


t = int(input())
while t:
	n = int(input())
	sum = 1
	k = 1
	while 1:
		sum += pow(2, k)
		if n % sum == 0:
			x = n // sum
			break
		else:
			k += 1
	t -= 1
	print(x)


import math
for _ in range(int(input())):
	n = int(input())
	for k in range(2, int(math.log(n + 1, 2)) + 1):
		if n % (pow(2, k) - 1) == 0:
			print(int(n / (pow(2, k) - 1)))
			break


test = int(input())
for t in range(test):
	n = int(input())
	i = 3
	k = 4
	flag = 1
	while flag == 1:
		if n % i == 0:
			print(n // i)
			flag = 0
		i += k
		k *= 2


def solve(n):
	for k in range(2, 32):
		k_sum = pow(2, k) - 1
		x = n // (pow(2, k) - 1)
		if x * k_sum == n:
			return x
	raise AssertionError

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		print(solve(n))
main()


testCase = int(input())
for k in range(testCase):
	n = int(input())
	k = 2
	while True:
		m = n % (2 ** k - 1)
		if m != 0:
			k = k + 1
		else:
			n = n // (2 ** k - 1)
			break
	print(n)


import math
t = int(input())
for i in range(t):
	n = int(input())
	k_max = int(math.log(n + 1, 2)) + 1
	for j in range(2, k_max):
		factor = 2 ** j - 1
		if n % factor == 0:
			print(n // factor)
			break


import math
for _ in range(int(input())):
	n = int(input())
	flag = 0
	d = []
	for k in range(2, 30):
		x = n / (math.pow(2, k) - 1)
		while x > 0:
			if x == int(x):
				d.append(int(n // (math.pow(2, k) - 1)))
			break
	print(d[0])


import math
t = int(input())
for i in range(t):
	n = int(input())
	num = 2
	a = []
	for j in range(1, 32):
		val = num * 2 - 1
		a.append(val)
		num = val + 1
	for j in a:
		if n % j == 0:
			print(int(n / j))
			break


t = int(input())
A = []
mul = 4
while mul < 1000000000:
	A.append(mul)
	mul = mul * 2
la = len(A)
for i in range(la):
	A[i] = A[i] - 1
for tests in range(t):
	n = int(input())
	for i in range(la):
		if n % A[i] == 0:
			print(int(n / A[i]))
			break


def f(n):
	pk = 4
	while n % (pk - 1) != 0:
		pk = pk << 1
	return n // (pk - 1)
t = int(input())
for _ in range(t):
	n = int(input())
	print(f(n))


for i in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3)
	else:
		b = 3
		c = 3
		while n % b != 0:
			b = 2 ** c - 1
			c += 1
		print(n // b)


INT_MAX = 10 ** 18 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
GETA = 123
for _ in range(int(input())):
	n = int(input())
	for k in range(2, 100):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


import math
t = int(input(''))
while t > 0:
	n = int(input(''))
	for k in range(1, math.ceil(math.log(n + 1, 2) + 1)):
		if n % (2 ** k - 1) == 0 and k != 1:
			print(n // (2 ** k - 1))
			break
	t -= 1


t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
b = []
for j in range(2, 500):
	b.append(2 ** j - 1)
for i in range(t):
	summ = a[i]
	for elem in b:
		if summ % elem == 0:
			print(summ // elem)
			break


I = lambda : list(map(int, input().split()))
l = [2 ** i - 1 for i in range(2, 31)]
for _ in range(int(input())):
	(n,) = I()
	for i in l:
		if n % i == 0:
			print(n // i)
			break


import time
lst = [int(input()) for i in range(int(input()))]
for n in lst:
	k = 2
	s = 3
	while True:
		if n % s == 0:
			x = n / s
			print(int(x))
			break
		else:
			s += 2 ** k
			k += 1


for i in range(int(input())):
	p = int(input())
	k = 0
	j = 2
	while j <= p:
		if p % (2 ** j - 1) == 0:
			k = p // (2 ** j - 1)
			break
		j += 1
	print(k)


a = []
for i in range(2, 33):
	a.append(2 ** i - 1)
n = int(input())
for i in range(n):
	t = int(input())
	for j in a:
		if t % j == 0:
			print(t // j)
			break
	else:
		print('NO')


import math

def func(n):
	for i in range(2, n + 1):
		if n % (pow(2, i) - 1) == 0:
			y = n // (pow(2, i) - 1)
			break
	return y
t = int(input())
while t:
	n = int(input())
	print(func(n))
	t -= 1


import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ans = -1
		log = int(math.log2(n)) + 1
		for k in range(2, log + 1):
			temp = 2 ** k - 1
			if n % temp == 0:
				ans = n // temp
				break
		print(ans)
main()


tstr = input()
t = int(tstr)
nums = list()
for i in range(t):
	nums.append(int(input()))
for i in range(len(nums)):
	j = 2
	pe = pow(2, j) - 1
	while nums[i] % pe != 0 and pe < nums[i]:
		j = j + 1
		pe = pow(2, j) - 1
	nums[i] = int(nums[i] / pe)
for i in range(len(nums)):
	print(nums[i])


import math
for _ in range(int(input())):
	n = int(input())
	i = '11'
	while 1:
		if n % int(i, base=2) == 0:
			print(n // int(i, base=2))
			break
		i = i + '1'


t = int(input())
for i in range(1, t + 1):
	n = int(input())
	y = 3
	n1 = 2
	while 1:
		if n % y == 0:
			print(n // y)
			break
		y += 1 << n1
		n1 += 1


t = int(input())
sm = 3
check = 2
for i in range(t):
	n = int(input())
	while n // sm != n / sm:
		sm += 2 ** check
		check += 1
	print(n // sm)
	(sm, check) = (3, 2)


total = int(input())
answers = []
for i in range(0, total):
	testCase = int(input())
	divider = 3
	k = 2
	while testCase % divider != 0:
		divider += 2 ** k
		k += 1
	print(testCase // divider)


for i in range(int(input())):
	a = int(input())
	o = True
	c = 3
	g = 2
	while o == True:
		if a % c == 0:
			o = False
		else:
			c += pow(2, g)
			g += 1
	print(int(a / c))


test_cases = int(input())
data = []
while test_cases > 0:
	data.append(int(input()))
	test_cases -= 1

def is_avail(num):
	k = 3
	plus = 4
	while num % k != 0:
		k += plus
		plus *= 2
	return num // k
for element in data:
	print(is_avail(element))


for _ in range(int(input())):
	n = int(input())
	i = 2
	div = 3
	while 1:
		if n / div == n // div:
			print(n // div)
			break
		div += 2 ** i
		i += 1


from math import log2, ceil
for i in range(int(input())):
	n = int(input())
	ind = ceil(log2(n))
	j = 4
	while j <= n:
		if n % (j - 1) == 0:
			break
		else:
			j *= 2
	print(n // (j - 1))


n = int(input())
for i in range(n):
	k = int(input())
	s = 3
	i = 2
	while k % s != 0:
		s = s + pow(2, i)
		i += 1
	print(k // s)


t = int(input())
for t1 in range(t):
	count = 0
	n = int(input())
	i = 2
	no = 0
	while no <= n:
		no = 2 ** i - 1
		if n % no == 0:
			print(int(n / no))
			count = 1
			break
		else:
			pass
		i = i + 1
	if count == 0:
		print(1)


for _ in range(int(input())):
	N = int(input())
	k = 2
	result = 0
	while True:
		if N % (2 ** k - 1) == 0:
			break
		k += 1
	result = N // (2 ** k - 1)
	print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	p2k = 4
	while n % (p2k - 1):
		p2k *= 2
	print(n // (p2k - 1))


for i in range(int(input())):
	n = int(input())
	for k in range(3, 99):
		if n % (2 ** (k - 1) - 1) == 0:
			print(n // (2 ** (k - 1) - 1))
			break


import math
for i in range(int(input())):
	n = int(input())
	for i in range(2, 32):
		y = math.pow(2, i) - 1
		c = n / y
		if c - int(c) == 0:
			print(int(c))
			break


for _ in range(int(input())):
	n = int(input())
	odd = 3
	c = 3
	while odd <= n:
		if n % odd == 0:
			print(n // odd)
			break
		odd = 2 ** c - 1
		c += 1


import math
import sys
t = int(input())
for cs in range(t):
	n = int(input())
	x = 2
	while 1:
		x *= 2
		if n % (x - 1) == 0:
			print(n // (x - 1))
			break


t = int(input())
for tt in range(t):
	n = int(input())
	for k in range(2, n):
		num = 2 ** k - 1
		if n % num == 0:
			print(int(n / num))
			break


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	k = 2
	while n % ((1 << k) - 1) != 0:
		k += 1
	print(n // ((1 << k) - 1))


l = []
l2 = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911]
for _ in range(int(input())):
	l1 = []
	x = int(input())
	for i in l2:
		if x % i == 0:
			l.append(x // i)
			break
		else:
			continue
for i in l:
	print(i)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		k = 2
		while True:
			m = 2 ** k - 1
			if n % m == 0:
				print(n // m)
				break
			k += 1
main()


t = int(input())
for _ in range(t):
	n = int(input())
	k = 4
	while n % (k - 1) != 0:
		k = k << 1
	print(n // (k - 1))


import math
import sys
from collections import *
input = sys.stdin.readline

def solve(num):
	i = 4
	while i - 1 <= num:
		if num % (i - 1) == 0:
			print(num // (i - 1))
			return
		else:
			i = i * 2
test = int(input())
while test:
	test = test - 1
	num = int(input())
	solve(num)


def output(x, a):
	print('{0}: {1}'.format(x, a))

def solve():
	data = int(input())
	for k in range(2, 100):
		base = 2 ** k - 1
		if data % base == 0:
			break
	print(data // base)
nums = int(input())
for _ in range(1, nums + 1):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(2, 10 ** 20):
		d = 2 ** j - 1
		if n % d == 0:
			break
	print(int(n / d))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	n = ii()
	t = 3
	for i in range(2, 31):
		if n % t == 0:
			print(n // t)
			break
		else:
			t += 2 ** i


import sys
import math
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	n = int(input())
	for k in range(2, n):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


iterations = int(input())
for i in range(iterations):
	n = int(input())
	k = 2
	while True:
		var = n / (2 ** k - 1)
		if var % 1 == 0:
			print(int(var))
			break
		k += 1


import math
n = int(input())
alist = []
blist = []
for i in range(n):
	m = int(input())
	alist.append(m)
for i in range(len(alist)):
	num = alist[i]
	nn = int(math.log2(num)) + 1
	for k in range(2, nn + 1):
		if num % (2 ** k - 1) == 0:
			blist.append(num // (2 ** k - 1))
			break
for i in blist:
	print(i)


t = int(input())
a = [3]
for i in range(2, 30):
	a.append(a[-1] + 2 ** i)
for case_num in range(t):
	n = int(input())
	for j in a:
		if n % j == 0:
			print(n // j)
			break


t = int(input())
while t:
	n = int(input())
	s = 3
	k = 2
	while n % s:
		s += 2 ** k
		k += 1
	print(n // s)
	t -= 1


from sys import stdin, stdout
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	T = int(rl())
	A = [3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911]
	for _ in range(T):
		n = int(rl())
		if n == 2:
			stdout.write(str(1))
			stdout.write('\n')
			continue
		for div in A:
			(q, r) = divmod(n, div)
			if r == 0:
				stdout.write(str(q))
				stdout.write('\n')
				break
	stdout.close()
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	div = n
	while div != 0:
		count += 1
		div //= 2
	for k in range(2, count + 1):
		val = math.pow(2, k)
		l = n / (val - 1)
		v = n // (val - 1)
		if l == float(v):
			print(int(v))
			break


def hello():
	n = int(input())
	k = 0
	s = 1
	while s <= n:
		k += 1
		s += 2 ** k
		if n % s == 0:
			print(n // s)
			return 0
a = int(input())
for i in range(a):
	hello()


def main():
	v = int(input())
	cc = [2 ** i for i in range(2, 34)]
	for i in range(v):
		c = int(input())
		for v in cc:
			if c % (v - 1) == 0:
				print(c // (v - 1))
				break
main()


t = int(input())
po2 = [4] * 30
for i in range(1, 30):
	po2[i] = po2[i - 1] * 2
	po2[i - 1] -= 1
po2[29] -= 1
for i in range(t):
	c = int(input())
	for k in po2:
		if c % k == 0:
			print(int(c / k))
			break


for _ in range(int(input())):
	a = []
	for i in range(2, 31):
		a.append(2 ** i - 1)
	n = int(input())
	for i in a:
		if n % i == 0:
			print(n // i)
			break


t = int(input())
count = 0
while count < t:
	count += 1
	n = int(input())
	k = 2
	x = n / (2 ** k - 1)
	while int(x) != x:
		k += 1
		x = n / (2 ** k - 1)
	print(int(x))


for _ in range(int(input())):
	s = int(input())
	for k in range(2, 30):
		x = s / (pow(2, k) - 1)
		if s % x == 0:
			print(int(x))
			break


import math
t = int(input())
res = []

def findX(n):
	k = 2
	while 2 ** k - 1 <= n:
		if n % (2 ** k - 1) == 0:
			return int(n / (2 ** k - 1))
		else:
			k += 1
for i in range(t):
	n = int(input())
	res.append(findX(n))
for i in res:
	print(i)


tests = int(input())
for i in range(tests):
	n = int(input())
	k = 2
	while True:
		x = n / (pow(2, k) - 1)
		if x.is_integer():
			print(int(x))
			break
		k += 1


def funct(c):
	(n, k) = (3, 3)
	while c % n != 0:
		n = 2 ** k - 1
		k += 1
	print(c // n)
test_cases = int(input())
for i in range(test_cases):
	c = int(input())
	funct(c)


import math
test = int(input())
while test:
	number = int(input())
	temp = 3
	index = 2
	div = 3
	while number % div != 0:
		div = pow(2, index) - 1
		index += 1
	print(int(number / div))
	test -= 1


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		n = 1
		for i in range(1, 31):
			n += 2 ** i
			(x, m) = divmod(N, n)
			if not m:
				print(x)
				break
main()


T = int(input())
for t in range(T):
	n = int(input())
	for k in range(2, n):
		v = n % (2 ** k - 1)
		if v == 0:
			print(int(n / (2 ** k - 1)))
			break


c = [int(2 ** x - 1) for x in range(2, 30 + 1)]
ans = []
for _ in range(int(input())):
	n = int(input())
	for x in c:
		if n % x == 0:
			ans.append(n // x)
			break
print('\n'.join(map(str, ans)))


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	l = []
	for _ in range(t):
		n = I()
		x = 0
		sm = 1
		for i in range(1, n):
			z = pow(2, i)
			sm += z
			if n % sm == 0:
				x = n // sm
				break
		print(x)
main()


t = int(input())
p = 0
while p < t:
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k = k + 1
	x = n / (2 ** k - 1)
	print(int(x))
	p = p + 1


numcases = int(input())
for i in range(numcases):
	n = int(input())
	ans = 0
	for i in range(2, 30):
		if n % (2 ** i - 1) == 0:
			ans = n / (2 ** i - 1)
			break
	print(int(ans))


t = int(input())
for i in range(t):
	n = int(input())
	p = 1
	ans = 0
	while n % (2 ** (p + 1) - 1) != 0:
		p = p + 1
	x = n // (2 ** (p + 1) - 1)
	print(x)


def tavan2(n):
	if n == 2:
		return 0
	t = 1
	while t <= n:
		t *= 2
	if t / 2 == n:
		return 1
	return 0

def do_job(n):
	i = 1
	while i * i <= n:
		if n % i == 0:
			s = n / i
			if tavan2(i + 1):
				return s
			if tavan2(s + 1):
				return i
		i += 1
ans = []
te = int(input())
for i in range(te):
	n = int(input())
	ans.append(int(do_job(n)))
for i in range(te):
	print(ans[i])


import math
for i in range(int(input())):
	n = int(input())
	k = 2
	while math.floor(n / (pow(2, k) - 1)) != n / (pow(2, k) - 1):
		k += 1
	print(math.floor(n / (pow(2, k) - 1)))


for _ in range(int(input())):
	n = int(input())
	k = 4
	sum = 0
	while True:
		if k > n + 1:
			break
		if n % (k - 1) == 0:
			print(n // (k - 1))
			break
		k *= 2


import math
for _ in range(int(input())):
	n = int(input())
	i = 3
	k = 2
	for j in range(1000000):
		if n % i == 0:
			print(n // i)
			break
		i = 2 ** k - 1
		k += 1


ls = [1]
nxt = 2
for i in range(29):
	ls.append(nxt + ls[-1])
	nxt *= 2
for _ in range(int(input())):
	n = int(input())
	i = int(1)
	while n % ls[i] != 0:
		i += 1
	print(n // ls[i])


import math
t = int(input())
for e in range(t):
	k = 2
	m = int(input())
	while 1:
		if m % (math.pow(2, k) - 1) == 0:
			ans = m // (math.pow(2, k) - 1)
			break
		k += 1
	print(int(ans))


t = int(input())
for tt in range(0, t):
	n = int(input())
	x = 1
	i = 2
	while n % (pow(2, i) - 1) != 0:
		i += 1
	x = n // (pow(2, i) - 1)
	print(x)


for t in range(int(input())):
	n = int(input())
	l = [1]
	for i in range(1, 35):
		tmp = l[-1] + 2 ** i
		l.append(tmp)
		if n % tmp == 0:
			print(n // tmp)
			break


T = int(input())
L = [1]
for i in range(1, 35):
	L.append(L[-1] * 2)
for _ in range(0, T):
	n = int(input())
	tot = 1
	for i in range(1, len(L)):
		tot += L[i]
		if n % tot == 0:
			print(n // tot)
			break


t = int(input())
while t:
	n = int(input())
	for i in range(2, 100):
		if not n % (2 ** i - 1):
			print(int(n / (2 ** i - 1)))
			break
	t -= 1


for i in range(int(input())):
	n = int(input())
	i = 1
	b = 1
	while True:
		b += 2 ** i
		if n % b == 0:
			break
		i += 1
	print(n // b)


t = int(input())
for i in range(t):
	n = int(input())
	k = 1
	den = 3
	while n % den != 0:
		k = k + 1
		den = den + 2 ** k
	print(int(n / den))


from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
power = [1]
for i in range(1, 31):
	power.append(power[i - 1] * 2)
total = [1]
s = 1
for i in range(1, 31):
	s = s + power[i]
	total.append(s)
while t > 0:
	n = int(input())
	for i in range(1, 31):
		if n % total[i] == 0:
			print(n // total[i])
			break
	t -= 1


a = input()
b = []
for i in range(int(a)):
	c = int(input())
	b.append(c)
plist = []
for i in range(2, 31):
	plist.append(2 ** i - 1)
for i in range(len(b)):
	for j in plist:
		if b[i] % j == 0:
			print(int(b[i] / j))
			break


def solve():
	n = int(input())
	(num, x) = (3, 2)
	while n % num != 0:
		x = x * 2
		num = num + x
	x = n // num
	print(x)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	i = 1
	s = 1
	while True:
		i = i << 1
		s += i
		if n % s == 0:
			break
	print(int(n / s))


import math

def cand(n, i, L):
	if i >= len(L):
		return 1
	elif L[i] == n:
		return 1
	elif n % L[i] == 0:
		return n // L[i]
	else:
		return cand(n, i + 1, L)
t = int(input())
for i in range(0, t):
	n = int(input())
	L = [3, 7, 31, 127, 2047, 8191, 131071, 524287, 8388607]
	print(cand(n, 0, L))


for _ in range(int(input())):
	N = int(input())
	answer = 0
	(val, upper) = (3, 4)
	while val <= N:
		if not N % val:
			answer = N // val
			break
		val += upper
		upper *= 2
	print(answer)


t = int(input())
for d in range(t):
	n = int(input())
	l = 0
	for k in range(1000000000):
		l = l + 2 ** k
		if l == 1:
			continue
		elif n % l == 0:
			x = n // l
			break
	print(x)


def inp():
	return int(input())
progression = [4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912]
t = inp()
nu = []
for i in range(0, t):
	nu.append(inp())
for n in nu:
	for j in progression:
		if n % (j - 1) == 0:
			print('%d' % (n / (j - 1)))
			break


T = int(input())
for i in range(T):
	n = int(input())
	t = 3
	k = 2
	while n % t != 0:
		t = t + 2 ** k
		k += 1
	ans = n // t
	print(ans)


t = int(input())
for w in range(t):
	n = int(input())
	k = 2
	while 1:
		if n % (pow(2, k) - 1) == 0:
			print(int(n / (pow(2, k) - 1)))
			break
		k += 1


def f(n):
	for i in range(2, n):
		if n % (2 ** i - 1) == 0:
			return n // (2 ** i - 1)
N = int(input())
while N > 0:
	n = int(input())
	print(f(n))
	N -= 1


for _ in range(int(input())):
	n = int(input())
	for k in range(2, n + 1):
		term = 2 ** k
		t2 = n / (term - 1)
		if t2 == int(t2):
			print(int(t2))
			break


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
times = 60
t = inp()
for _ in range(t):
	n = inp()
	start = 3
	ne = 4
	while True:
		if n % start == 0:
			print(n // start)
			break
		start += ne
		ne *= 2


for i in range(int(input())):
	g = int(input())
	d = 3
	m = 1
	while g % d:
		d += d + 1
	print(g // d)


for t in range(int(input())):
	n = int(input())
	v = s = 1
	while 1:
		v = v * 2
		s += v
		if n % s == 0:
			print(n // s)
			break


import math as m
t = int(input())
while t:
	n = int(input())
	x = m.log2(n)
	x = x // 1
	x += 1
	x = int(x)
	for i in range(2, 10000):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
	t -= 1


n = int(input())
list = []
for e in range(n):
	num = int(input())
	k = 3
	while k:
		value = 2 ** (k - 1) - 1
		if num % value == 0:
			x = num // value
			list.append(str(x))
			break
		k += 1
print('\n'.join(list))


from sys import stdin

def func():
	return
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	k = 2
	m = 2 ** k - 1
	while m <= n:
		if n % m == 0:
			break
		k += 1
		m = 2 ** k - 1
	print(n // m)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

def LI():
	return list(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def solve(x):
	b = [pow(2, i) - 1 for i in range(2, len(bin(x)))]
	for i in b:
		if x % i == 0:
			print(x // i, flush=True)
			return
	return
for i in range(II()):
	solve(II())


import math
test = int(input())
i = 1
while i <= test:
	n = int(input())
	curr = 4
	while curr - 1 <= n:
		if n % (curr - 1) == 0:
			print(n // (curr - 1))
			break
		else:
			curr = curr * 2
	i += 1


from sys import stdin

def solve():
	n = int(input())
	d = 1
	s = 1
	while True:
		s += 2 ** d
		if n % s == 0:
			return n // s
		else:
			d += 1
t = int(input())
for i in range(t):
	print(solve())


n = int(input())
for i in range(0, n):
	x = int(input())
	k = 2
	while 1:
		g = pow(2, k) - 1
		if x % g == 0:
			print(x // g)
			break
		else:
			k = k + 1


for i in range(int(input())):
	n = int(input())
	step_2 = 2
	dva = 3
	while n % dva != 0:
		dva = dva + 2 ** step_2
		step_2 += 1
	print(n // dva)


import sys
input = lambda : sys.stdin.readline().rstrip()
dp = [3]
for i in range(1000):
	dp.append(dp[-1] * 2 + 1)
for _ in range(int(input())):
	a = int(input())
	for i in dp:
		if a % i == 0:
			print(a // i)
			break


t = int(input())
import math
for _ in range(t):
	n = int(input())
	kmax = math.ceil(math.log(n, 2)) + 2
	for k in range(2, kmax):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


from math import sqrt
n = int(input())
for i in range(n):
	a = int(input())
	for i in range(2, 30):
		if a % (2 ** i - 1) == 0:
			print(a // (2 ** i - 1))
			break


t = int(input())
list_ans = []
for i in range(t):
	s = int(input())
	for x in range(2, 36):
		if s % (2 ** x - 1) == 0:
			list_ans.append(int(s / (2 ** x - 1)))
			break
for item in list_ans:
	print(item)


def func(n, k):
	return n // (pow(2, k) - 1)
for _ in range(int(input())):
	n = int(input())
	k = 2
	while pow(2, k) - 1 <= n:
		x = func(n, k)
		if n // (pow(2, k) - 1) > 0 and n % (pow(2, k) - 1) == 0:
			print(x)
			break
		k += 1


t = int(input())
st = []
for i in range(1, 31):
	st.append(2 ** (i + 1) - 1)
l = []
for i in range(t):
	n = int(input())
	i = 0
	while n % st[i] != 0:
		i += 1
	l.append(n // st[i])
print('\n'.join(map(str, l)))


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 30):
		luku = float(n / (2 ** k - 1))
		if luku.is_integer():
			break
	print(int(luku))


import sys
input = sys.stdin.readline
for i in range(int(input())):
	n = int(input())
	k = 2
	x = -1
	while 1:
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			break
		k += 1
	print(x)


k = list(map(int, input().split()))
t = k[0]
for i in range(t):
	n = list(map(int, input().split()))
	n = n[0]
	k = 2
	ch = 3
	otvet = 0
	while ch <= n:
		if n % ch == 0:
			otvet = int(n // ch)
			break
		else:
			k = k + 1
			ch = int((ch + 1) * 2 - 1)
	print(otvet)


t = int(input())
c = []
for x in range(t):
	c.append(int(input()))
q = []
for x in range(2, 31):
	q.append(2 ** x - 1)
for x in range(len(c)):
	for y in range(31):
		if c[x] % q[y] == 0:
			print(c[x] // q[y])
			break


import math
import random
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, UserDict, defaultdict, deque, namedtuple
from functools import cmp_to_key, lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, combinations_with_replacement, permutations, product
sys.setrecursionlimit(10 ** 5 + 1)
input = sys.stdin.buffer.readline
MOD = 10 ** 9 + 7

def f(k):
	return 2 ** k - 1
T = int(input())
for _ in range(T):
	n = int(input())
	for k in range(2, n):
		d = f(k)
		if n % d == 0:
			print(n // d)
			break


test = int(input())
for i in range(test):
	num = int(input())
	j = 4
	k = 3
	while num % k != 0 and k < num:
		j = j << 1
		k = j - 1
	print(num // k)


from collections import Counter
from _collections import defaultdict
import math
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	n = int(input())
	s = 0
	for i in range(0, 100):
		s = s + pow(2, i)
		if n % s == 0 and i != 0:
			print(n // s)
			break


T = int(input())
for test in range(T):
	N = int(input())
	exp = 1
	while N % (2 ** (exp + 1) - 1) != 0:
		exp += 1
	x = N // (2 ** (exp + 1) - 1)
	print(x)


from sys import stdin
temp = []
for i in range(2, 30):
	temp.append(2 ** i - 1)

def help():
	stri = stdin.readline().strip('\n')
	n = int(stri)
	for i in temp:
		if n % i == 0:
			print(n // i)
			return
for i in range(int(stdin.readline())):
	help()


def findx(n):
	solved = False
	k = 1
	divisor = 1
	while solved == False:
		k += 1
		divisor += 2 ** (k - 1)
		if n % divisor == 0:
			solved = True
	return int(n / divisor)
t = int(input())
for _ in range(t):
	n = int(input())
	print(findx(n))


T = int(input())
for t in range(T):
	n = int(input())
	x = 2
	s = 3
	while True:
		if n % s == 0:
			ans = n // s
			break
		x = x << 1
		s += x
	print(ans)


tc = int(input())
for i in range(tc):
	x = int(input())
	for k in range(2, 100):
		temp = pow(2, k) - 1
		if x % temp == 0:
			print(int(x / temp))
			break


def solve(a):
	x = 0
	for k in range(2, 36):
		p = 2 ** k - 1
		if a % p:
			continue
		x = a // p
		break
	return x
t = int(input())
while t:
	in_ = int(input())
	print(solve(in_))
	t -= 1


for p in [*open(0)][1:]:
	(a, b) = (int(p), 3)
	while a % b:
		b -= ~b
	print(a // b)


num_t = int(input())
twos = [4]
while twos[-1] < 10 ** 9:
	twos.append(twos[-1] * 2)
two_sub_one = [x - 1 for x in twos]
for i in range(num_t):
	n = int(input())
	for val in two_sub_one:
		if n % val == 0:
			print(n // val)
			break


t = int(input())
while t:
	n = int(input())
	k = 4
	while n % (k - 1) > 0:
		k = k * 2
	print(n // (k - 1))
	t = t - 1


def process(n):
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	return n // (2 ** k - 1)

def io():
	T = int(input())
	for i in range(T):
		n = int(input())
		print(process(n))
io()


import sys
import math
from collections import defaultdict

def solve(t):
	n = int(input())
	i = 3
	w = 2
	while i <= n // 2:
		if n % i == 0:
			print(n // i)
			return
		w *= 2
		i += w
	print(1)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


t = int(input())
for _ in range(t):
	n = int(input())
	dp = [1, 2]
	flag = False
	while not flag:
		if n % sum(dp) != 0:
			x = dp[-1]
			dp.append(x * 2)
		else:
			s = n // sum(dp)
			flag = True
	print(s)


T = int(input())
for i in range(T):
	n = int(input())
	s = 3
	i = 2
	t = 0
	while t == 0:
		if n % s == 0:
			t = 1
			print(n // s)
		else:
			s = s + 2 ** i
			i = i + 1


import sys
input = sys.stdin.readline
import heapq
import copy
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		n = inp()
		k = 4
		while True:
			if n % (k - 1) == 0:
				break
			k = k * 2
		print(int(n / (k - 1)))
	return 0
main()


t = int(input())
i = 0
while i < t:
	n = int(input())
	k = 1
	while True:
		k = k + 1
		p = 2 ** k - 1
		if n % p == 0:
			print(int(n / p))
			break
	i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	k = 1
	more = True
	while more:
		k += 1
		candies = 2 ** k - 1
		more = n % candies != 0
	print(n // candies)


E = []
e = 1
for k in range(1, 31):
	e += 2 ** k
	if e > 10 ** 9:
		break
	E.append(e)
for _ in range(int(input())):
	n = int(input())
	for e in E:
		if n % e == 0:
			print(n // e)
			break


list1 = []
for a in range(2, 31):
	list1.append(2 ** a - 1)
a = int(input())
for _ in range(a):
	b = int(input())
	for c in list1:
		if b % c == 0:
			print(b // c)
			break


import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
ll = [3]
while ll[-1] <= 1000000000000:
	ll.append((ll[-1] + 1) * 2 - 1)
t = int(input())
while t:
	n = int(input())
	for i in ll:
		if n % i == 0:
			print(n // i)
			break
	t -= 1


def sol(n):
	k = 3
	while n % k != 0:
		k = 2 * k + 1
	x = n // k
	return x
t = int(input())
for i in range(t):
	n = int(input())
	print(sol(n))


t = int(input())
while t > 0:
	n = int(input())
	k = 1
	d = 0
	while k < n + 1:
		d += 2 ** (k - 1)
		if n % d == 0 and k > 1:
			print(n // d)
			break
		k += 1
	t -= 1


t = int(input())
for case in range(t):
	n = int(input())
	k = 2
	status = True
	while status and 2 ** k <= n:
		if n % (2 ** k - 1) == 0:
			status = False
			break
		k += 1
	print(n // (2 ** k - 1))


t = int(input())
while t:
	s = int(input())
	k = 2
	p = pow(2, k) - 1
	if s % p == 0:
		print(s // p)
	else:
		while s % p != 0:
			k += 1
			p = pow(2, k) - 1
		print(s // p)
	t -= 1


import math
t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for i in range(t):
	n = a[i]
	temp = n
	if temp > 100:
		temp = int(math.sqrt(n))
	for j in range(2, temp):
		d = 2 ** j - 1
		if n % d == 0:
			print(int(n / d))
			break


for _ in range(int(input())):
	n = int(input())
	p = 3
	res = 0
	for i in range(2, 10000):
		if n % p == 0:
			res = n // p
			break
		p += 2 ** i
	print(res)


import math
for _ in range(int(input())):
	n = int(input())
	i = 2
	while True:
		tmp = n / (2 ** i - 1)
		if math.ceil(tmp) == int(tmp):
			print(int(tmp))
			break
		else:
			i += 1


import sys
import collections, itertools, bisect, heapq, math, string

def input():
	return sys.stdin.readline().strip()

def main():
	t = int(input())
	n = [int(input()) for x in range(t)]
	for i in n:
		for k in range(2, 50):
			power = 2 ** k - 1
			if i % power == 0:
				print(i // power)
				break
main()


import math

def oddeven(n):
	for k in range(2, n):
		y = n % (2 ** k - 1)
		x = n / (2 ** k - 1)
		if y == 0:
			return int(x)
		else:
			continue
t = int(input())
for tcase in range(t):
	n = int(input())
	print(oddeven(n))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	k = 2
	while k < n:
		div = pow(2, k) - 1
		if n % div == 0:
			x = n // div
			print(x)
			break
		k += 1


for _ in range(int(input())):
	ct = int(input())
	x = 3
	while x <= ct:
		if ct % x == 0:
			print(ct // x)
			break
		x = x << 1 | 1


t = int(input())

def fun(n):
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(int(n / (2 ** k - 1)))
while t:
	t -= 1
	n = int(input())
	fun(n)


def main():
	t = int(input())
	for i in range(t):
		z = 1
		n = int(input())
		for i in range(1, n):
			z += 2 ** i
			if n % z == 0:
				print(int(n / z))
				break
			else:
				continue
main()


T = int(input())
for _ in range(T):
	n = int(input())
	ans = 0
	for k in range(2, 50):
		if n % (2 ** k - 1) == 0:
			ans = n // (2 ** k - 1)
			break
	print(ans)


t = int(input())
for T in range(t):
	n = int(input())
	xx = 3
	add = 4
	while True:
		if n % xx == 0:
			print(f'{int(n / xx)}')
			break
		xx += add
		add *= 2


arr = [[], []]

def out1(x, n, m):
	if x <= 0:
		return True
	if n <= 0:
		if x - 10 * m > 0:
			return False
		else:
			return True
	if m <= 0:
		return False
	return out1(x // 2 + 10, n - 1, m) or out1(x - 10, n, m - 1)

def out(x):
	k = 2
	while x >= 2 ** k - 1:
		if x % (2 ** k - 1) == 0:
			return x // (2 ** k - 1)
		k += 1
	return x
for i in range(int(input())):
	x = int(input())
	print(out(x))


t = int(input())
for test in range(t):
	n = int(input())
	ans = 0
	for i in range(2, 30):
		temp = 2 ** i - 1
		if n % temp == 0:
			ans = n // temp
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	(divider, adder) = (3, 4)
	ans = 1
	while n % divider != 0:
		ans += 1
		divider += adder
		adder *= 2
	print(n // divider)


def solve():
	n = int(input())
	k = 4
	while n % (k - 1) != 0:
		k *= 2
	print(n // (k - 1))
t = int(input())
for i in range(t):
	solve()


for i in range(int(input())):
	n = int(input())
	tmp = 3
	while True:
		if n % tmp == 0:
			print(int(n / tmp))
			break
		else:
			tmp = tmp * 2 + 1


for i in range(int(input())):
	n = int(input())
	for k in range(2, 999999999):
		if n % (2 ** k - 1) == 0:
			c = n // (2 ** k - 1)
			break
	print(c)


t = eval(input())
for i in range(t):
	n = int(input())
	while True:
		flag = 0
		for k in range(2, 1000, 1):
			x = n % (2 ** k - 1)
			if x == 0:
				print(n // (2 ** k - 1))
				flag = 1
				break
			else:
				continue
		if flag == 1:
			break


for _ in range(int(input())):
	n = int(input())
	ans = 0
	count = 0
	for i in range(2, n):
		ans = n / (2 ** i - 1)
		if ans % int(ans) == 0:
			print(int(ans))
			break


for t in range(int(input())):
	s = int(input())
	k = 2
	while k > 0:
		if s % (2 ** k - 1) == 0:
			print(s // (2 ** k - 1))
			break
		k = k + 1


def solve(n):
	count = 2
	total = 1
	while True:
		total += count
		if n % total == 0:
			return n // total
		count *= 2
t = int(input())
for i in range(t):
	n = int(input())
	print(solve(n))


def series():
	li = []
	x = 4
	while x < 1000000000:
		li.append(x - 1)
		x = x * 2
	return li
li = series()
for _ in range(int(input())):
	n = int(input())
	for i in li:
		if n % i == 0:
			print(n // i)
			break


import math
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('YES')
no = lambda : print('NO')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
l = []
temp = 2
for i in range(30):
	temp *= 2
	l.append(temp - 1)
for i in range(t):
	n = II()
	for j in range(30):
		if n % l[j] == 0:
			print(n // l[j])
			break


t = int(input())
for testcase in range(t):
	n = int(input())
	for i in range(2, 50):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


t = int(input())

def f(k):
	s = 1
	if k == 1:
		return s
	s = 2 * f(k - 1) + 1
	return s
a = []
for i in range(2, 30):
	a.append(f(i))
for i in range(t):
	n = int(input())
	if n in a:
		print(1)
	else:
		j = 0
		while n % a[j] != 0:
			j += 1
		else:
			print(n // a[j])


t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	j = 1
	ch = 2
	while j < n:
		j += ch
		if n % j == 0:
			print(n // j)
			j = 2 * n
		ch *= 2


import math
t = int(input())
a = []
tek = 0
for i in range(32):
	tek += 2 ** i
	if tek != 1:
		a.append(tek)
while t > 0:
	t -= 1
	n = int(input())
	for i in a:
		if n % i == 0:
			print(n // i)
			break


k = int(input())
for i in range(k):
	s = float(input())
	j = 2
	x = 1.1
	while 1:
		x = s / (2 ** j - 1)
		if x.is_integer():
			print(int(x))
			break
		j += 1


n = int(input())
for i in range(0, n):
	num = int(input())
	su = 0
	for k in range(1, num):
		su = su + 2 ** (k - 1)
		if num == su:
			print(1)
			break
		elif num % su == 0 and k != 1:
			print(num // su)
			break


l = []
for i in range(2, 31):
	l.append(2 ** i - 1)
t = int(input())
for _ in range(t):
	n = int(input())
	for e in l:
		if n % e == 0:
			print(n // e)
			break


power_of_2 = [0] * 100
power_of_2[0] = 1
for i in range(1, 100):
	power_of_2[i] = power_of_2[i - 1] * 2
for i in range(1, 100):
	power_of_2[i] = power_of_2[i - 1] + power_of_2[i]
test = int(input())
for i in range(test):
	n = int(input())
	for i in range(1, 100):
		if n % power_of_2[i] == 0:
			print(n // power_of_2[i])
			break


t = int(input())
out = ''
while t > 0:
	t -= 1
	n = int(input())
	s = 3
	w = 1
	while n % s != 0:
		w += 1
		s += 2 ** w
	out += f'{n // s}\n'
print(out)


qtd = int(input())
for i in range(qtd):
	val = int(input())
	volta = True
	k = 2
	while val % (2 ** k - 1) != 0:
		k += 1
	print(int(val / (2 ** k - 1)))


for _ in range(int(input())):
	n = int(input())
	p = 3
	i = 2
	while 1:
		if not n % p:
			print(n // p)
			break
		p += 2 ** i
		i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	x = 0
	k = 0
	s = 1
	p = 1
	while x * k != n or s != n:
		if s == n:
			x = 1
			break
		elif n % s == 0 and s != 1:
			x = n // s
			break
		p *= 2
		s += p
		k += 1
	print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	temp = 3
	while temp <= n:
		if n % temp == 0:
			print(n // temp)
			break
		temp += 1
		temp *= 2
		temp -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 31):
		val = (1 << k) - 1
		if not n % val:
			print(n // val)
			break


n = int(input())
q = []
for _ in range(n):
	q.append(int(input()))
for i in q:
	n = 2
	while n:
		if i % (2 ** n - 1) == 0:
			print(i // (2 ** n - 1))
			break
		n += 1


import math
t = int(input())
while t > 0:
	n = int(input())
	for power in range(2, 32):
		val = math.pow(2, power) - 1
		x = n / val
		if int(x) * val == n:
			break
	print(int(x))
	t -= 1


a = int(input())
for i in range(0, a):
	j = 2
	b = int(input())
	while True:
		if b % (2 ** j - 1) == 0:
			break
		j += 1
	print(int(b / (2 ** j - 1)))


import math
t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	n = int(input())
	k = 2
	power = 4
	while k < math.log(n, 2) + 1:
		power = 2 ** k
		if n % (power - 1) == 0:
			break
		else:
			k += 1
	print(n // (power - 1))


t = int(input())
for i in range(t):
	n = int(input())
	total = 3
	i = 2
	while n % total != 0:
		i *= 2
		total += i
	print(n // total)


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	n = iinput()
	temp = 3
	i = 3
	while True:
		if n % temp == 0:
			break
		temp += 2 ** (i - 1)
		i += 1
	print(n // temp)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = inp()
	for i in range(t):
		solve()

def solve():
	n = inp()
	mult = 4
	cur = 3
	while cur <= n and n % cur != 0:
		cur += mult
		mult *= 2
	print(n // cur)
BUFSIZE = 8192

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
for i in range(n):
	N = int(input())
	for k in range(2, 32):
		t = 0
		x = N / (2 ** k - 1)
		t = x
		if int(t) == x:
			print(int(x))
			break
		else:
			continue


def f(x):
	a = []
	for i in range(2, 30):
		a.append(2 ** i - 1)
	for j in a:
		if x % j == 0:
			return x // j
t = int(input())
for i in range(0, t):
	n = int(input())
	print(f(n))


tc = int(input().strip())

def solve():
	n = int(input().strip())
	k = 4
	while True:
		if n % (k - 1) == 0:
			return n // (k - 1)
		k <<= 1
for t in range(1, tc + 1):
	print(solve())


t = input()
t = int(t)
while t:
	N = input()
	N = int(N)
	for i in range(2, 100):
		x = N / (2 ** i - 1)
		if x == int(x):
			print(int(x))
			break
		else:
			continue
	t = t - 1


import math
t = int(input())
a = []
i = 0
s = 0
while 1:
	s += math.pow(2, i)
	i += 1
	a.append(s)
	if s > 1000000000.0:
		break
a.remove(1)
i = 1
while i <= t:
	n = int(input())
	for j in a:
		if n % j == 0:
			print(math.trunc(n / j))
			break
	i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	sumi = 3
	k = 3
	while True:
		if sumi > n:
			break
		elif n % sumi == 0 and k > 1:
			print(n // sumi)
			break
		else:
			sumi += 2 ** (k - 1)
			k += 1


import math
t = int(input())
while t != 0:
	t -= 1
	x = int(input())
	flag = False
	s = 2
	while flag != True and s < 30:
		res = x / (pow(2, s) - 1)
		if res.is_integer() and res > 0:
			flag = True
			print(int(res))
		else:
			s += 1


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))
for i in range(inp()):
	n = inp()
	for k in range(2, 100):
		K = 2 ** k - 1
		if n % K == 0:
			print(n // K)
			break


def calc(n):
	k = 2
	while True:
		i = 2 ** k - 1
		if n % i == 0:
			return n // i
		k += 1
try:
	t = int(input())
	for i in range(t):
		n = int(input())
		print(calc(n))
except:
	pass


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	ans = 0
	for i in range(2, 36):
		p = 1 << i
		p -= 1
		if n % p == 0:
			ans = n // p
			break
	print(ans)


t = int(input())
for q in range(t):
	n = int(input())
	x = 3
	ch = 4
	while 1:
		if n % x == 0:
			print(n // x)
			break
		x += ch
		ch *= 2


for t in range(int(input())):
	n = int(input())
	pow2 = 4
	while n % (pow2 - 1) != 0:
		pow2 *= 2
	print(n // (pow2 - 1))


t = int(input())
res = []
i = 1
ind = []
while i <= 10 ** 9:
	ind.append(i)
	i *= 2
pref = []
for i in range(len(ind)):
	if i == 0:
		pref.append(ind[i])
		continue
	pref.append(ind[i] + pref[i - 1])
pref.pop(0)
for j in range(t):
	n = int(input())
	for el in pref:
		if n % el == 0:
			res.append(n // el)
			break
for el in res:
	print(el)


tt = int(input())
while tt:
	n = int(input())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(int(n / (2 ** k - 1)))
	tt -= 1


t_cases = int(input())
for t_case in range(t_cases):
	n = int(input())
	is_x = False
	k = 2
	max_k = k
	while True:
		if 2 ** (max_k + 1) < 10 ** 9:
			max_k += 1
			continue
		break
	while not is_x:
		for k_i in range(k, max_k + 1):
			curr_sum = 2 ** k_i - 1
			if n % curr_sum == 0:
				is_x = True
				break
	print(n // curr_sum)


def ans(a):
	i = 1
	tp = 1
	while True:
		tp = tp + 2 ** i
		i = i + 1
		z = a / tp
		if a % tp == 0:
			return int(z)
t = int(input())
for i in range(t):
	a = int(input())
	print(ans(a))


from math import ceil
from sys import stdin, stdout, setrecursionlimit
for _ in range(int(input())):
	n = int(input())
	cur1 = 3
	cur2 = 4
	while True:
		if n % cur1 == 0:
			print(n // cur1)
			break
		cur1 += cur2
		cur2 *= 2


from math import pow as pow
q = int(input())
for i in range(q):
	n = int(input())
	k = 2
	while n % (pow(2, k) - 1) != 0:
		k += 1
	print(int(n / (pow(2, k) - 1)))


def solve_case():
	n = int(input())
	for i in range(2, 32):
		k = 2 ** i
		k -= 1
		if n % k == 0:
			return int(n / k)

def main():
	tests = int(input())
	for t in range(1, tests + 1):
		print('{}'.format(solve_case()))
main()


b = int(input())
for i in range(1, b + 1):
	t = 0
	c = int(input())
	for j in range(2, 30):
		t = c / (2 ** j - 1)
		if t.is_integer():
			break
	print(int(t))


import math
import collections
from sys import *
T = int(stdin.readline())
for _ in range(T):
	n = int(input())
	k = 1
	count = 1
	result = True
	x = 0
	while result:
		count = count + 2 ** k
		k = k + 1
		if n % count == 0:
			x = n // count
			result = False
	print(x)


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, input().split()))

def ei():
	return map(int, input().split())

def ip():
	return int(stdin.readline())

def op(ans):
	return stdout.write(str(ans) + '\n')
for i in range(ip()):
	n = ip()
	j = 1
	s = 1
	while 1:
		s += 2 ** j
		if n % s == 0:
			print(n // s)
			break
		else:
			j += 1


t = int(input())
for i in range(t):
	n = int(input())
	c = 3
	y = 2
	while n % c != 0:
		res = pow(2, y)
		c += res
		y += 1
	print(n // c)


t = int(input())
for _ in range(t):
	n = int(input())
	temp = 4
	while temp <= n + 1:
		if n % (temp - 1) == 0:
			print(n // (temp - 1))
			break
		else:
			temp *= 2


T = int(input())
for _ in range(T):
	n = int(input())
	for k in range(2, 36):
		d = pow(2, k) - 1
		if n % d == 0:
			print(int(n / d))
			break


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, functools

def solve(line):
	n = int(line)
	p = 4
	while True:
		if n % (p - 1) == 0:
			return n // (p - 1)
		p *= 2
	return -1
T = int(sys.stdin.readline())
t = 0
while True:
	line = sys.stdin.readline().rstrip()
	if not line:
		break
	print(solve(line))
	t += 1


x = [pow(2, i) - 1 for i in range(2, 30)]
for _ in range(int(input())):
	N = int(input())
	for i in range(len(x)):
		if x[i] <= N:
			if N / x[i] == N // x[i]:
				print(N // x[i])
				break
		else:
			break


import sys
input = sys.stdin.readline
from math import *
import bisect as bs
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	z = 2
	for i in range(2, 100):
		if n % (2 ** i - 1) == 0:
			z = i
			break
	print(n // (2 ** z - 1))


lst = []
for i in range(2, 31):
	lst.append(2 ** i - 1)
for test in range(int(input())):
	n = int(input())
	for i in lst:
		if n % i == 0:
			print(n // i)
			break


t = int(input())
for i in range(t):
	n = int(input())
	sum = 1
	z = 0
	for j in range(1, n):
		a = 2 ** j
		sum = sum + a
		if n % sum == 0:
			print(n // sum)
			z = 1
			break
		else:
			continue


for i in range(int(input())):
	n = int(input())
	sy = 1
	k = 2
	for i in range(100):
		sy += k
		k = k * 2
		if n % sy == 0:
			print(n // sy)
			break


power = [1]
for i in range(1, 31):
	power.append(power[-1] + 2 ** i)
for i in range(int(input())):
	num = int(input())
	for j in power[1:]:
		if num % j == 0:
			print(num // j)
			break


for __ in range(int(input())):
	n = int(input())
	for i in range(2, 31):
		if n % ((1 << i) - 1) == 0:
			print(n // ((1 << i) - 1))
			break


t = int(input())
factors = []
for i in range(2, 40):
	factors.append(2 ** i - 1)
for _ in range(t):
	n = int(input())
	for f in factors:
		if n % f == 0:
			print(n // f)
			break


for _ in range(int(input())):
	n = int(input())
	for i in range(2, 10 ** 5):
		if n % (2 ** i - 1) == 0:
			break
	print(n // (2 ** i - 1))


tests = int(input())
while tests > 0:
	n = int(input())
	k = 3
	while True:
		if n % k == 0:
			print(n // k)
			break
		else:
			k = k * 2 + 1
	tests = tests - 1


from sys import stdin, stdout
from math import log, ceil, floor

def works(x):
	x = log(x, 2)
	if ceil(x) == floor(x):
		return True
	return False

def solve(n):
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			stdout.write(f'{n // (2 ** k - 1)}\n')
			return
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	solve(n)


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
two_pows = dict()
curr_pow = 4
while curr_pow < 10 ** 9 + 2:
	two_pows[curr_pow] = 1
	curr_pow *= 2

def solve():
	N = getInt()
	for x in two_pows:
		if N % (x - 1) == 0:
			return N // (x - 1)
for t in range(getInt()):
	ans = solve()
	print(ans)


from sys import stdin
input = stdin.readline

def solve(n: int) -> int:
	k = 3
	while True:
		if n % k == 0:
			return n // k
		k = k * 2 + 1
t = int(input())
for i in range(t):
	print(solve(int(input())))


t = int(input())
for _ in range(t):
	n = int(input())
	p = 3
	d = 2
	while 1:
		if n % p == 0:
			print(n // p)
			break
		p += 2 ** d
		d += 1


t = int(input())
while t > 0:
	x = int(input())
	n = x // 2 + 2
	for i in range(2, n):
		y = pow(2, i) - 1
		if x % y == 0:
			z = x // y
			break
	print(x // y)
	t = t - 1


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for test in range(t):
	n = inp()
	for j in range(2, 40):
		if n % (2 ** j - 1) == 0:
			print(int(n / (2 ** j - 1)))
			break


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = int(math.log(n, 2))
	for k in range(2, s + 10):
		if n % (1 - math.pow(2, k)) == 0:
			print(int(n / (math.pow(2, k) - 1)))
			break


n = int(input())
l = []
S = 0
for i in range(0, 1000):
	if i == 0:
		l.append(2 ** i)
	else:
		l.append(2 ** i + l[i - 1])
for i in range(0, n):
	o = int(input())
	for j in range(1, len(l)):
		if o % l[j] == 0:
			print(o // l[j])
			break


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = int(input())
li = []
for i in range(2, 32):
	li.append(2 ** i - 1)
for i in range(t):
	n = int(input())
	for ele in li:
		if n % ele == 0:
			print(n // ele)
			break


for i in range(int(input())):
	s = 3
	n = int(input())
	while True:
		if n % s == 0:
			print(n // s)
			break
		else:
			s += s + 1


for i in range(int(input())):
	x = int(input())
	i = 2
	a = 0
	while x % (pow(2, i) - 1) != 0:
		i += 1
	a = x // (pow(2, i) - 1)
	print(int(a))


from math import sqrt
for _ in range(int(input())):
	num = int(input())
	for x in range(2, num):
		if num % (2 ** x - 1) == 0:
			print(num // (2 ** x - 1))
			break


t = int(input())
b = []
tmp = 4
while tmp <= int(10000000000.0):
	b.append(tmp - 1)
	tmp *= 2
for _ in range(t):
	n = int(input())
	for i in b:
		if n % i == 0:
			print(n // i)
			break


t = int(input())
mocniny = []
for i in range(2, 37):
	mocniny.append(2 ** i - 1)
for i in range(t):
	n = int(input())
	for j in range(37):
		if n % mocniny[j] == 0:
			print(n // mocniny[j])
			break
		else:
			continue


test = int(input())
while test:
	n = int(input())
	k = 2
	while True:
		ans = n % (2 ** k - 1)
		if not ans:
			ans = n // (2 ** k - 1)
			break
		k += 1
	print(ans)
	test -= 1


num = int(input())
for i in range(num):
	n = int(input())
	k = 2
	while 2 ** k - 1 <= n:
		ans = n / (2 ** k - 1)
		if ans.is_integer():
			print(int(ans))
			break
		k += 1


p = []
for i in range(2, 34):
	p.append(2 ** i - 1)
t = int(input())
for _ in range(t):
	n = int(input())
	for i in p:
		if n % i == 0:
			print(n // i)
			break


l = []
for i in range(2, 35):
	l.append((1 << i) - 1)
for _ in range(int(input())):
	k = int(input())
	for i in l:
		if k % i == 0:
			print(k // i)
			break


import math
t = int(input())
while t > 0:
	n = int(input())
	for k in range(2, 31):
		y = pow(2, k) - 1
		x = n / y
		if x.is_integer():
			print(int(x))
			break
	t = t - 1


for i in range(int(input())):
	n = int(input())
	a = 1
	for j in range(1, n):
		a += 2 ** j
		f = n // a
		k = n / a
		if f == k:
			break
	print(f)


def cin():
	return map(int, input().split())

def cino(test=False):
	if not test:
		return int(input())
	else:
		return input()

def cina():
	return list(map(int, input().split()))

def ssplit():
	return list(input().split())

def printlist(l):
	for i in l:
		print(i, end=' ')
n = cino()
for _ in range(n):
	a = cino()
	cnt = 2
	while True:
		if a % (2 ** cnt - 1) == 0:
			print(a // (2 ** cnt - 1))
			break
		cnt += 1


t = int(input())
while t > 0:
	n = int(input())
	k = 2
	flag = True
	while flag:
		if n % (pow(2, k) - 1) == 0:
			print(int(n / (pow(2, k) - 1)))
			flag = False
		else:
			k += 1
	t -= 1


def find_candies(n):
	pow2 = 2
	curr_sum = 3
	while n % curr_sum != 0:
		pow2 *= 2
		curr_sum += pow2
	return n // curr_sum
test_cases_number = int(input())
for _ in range(test_cases_number):
	n = int(input())
	result = find_candies(n)
	print(result)


outputx = []
for i in range(int(input())):
	n = int(input())
	for k in range(2, 36):
		if n % (2 ** k - 1) == 0:
			outputx.append(n // (2 ** k - 1))
			break
print(*outputx, sep='\n')


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())
for t in range(1, T + 1):
	n = int(lines[t].strip())
	curr = 4
	while n % (curr - 1) != 0:
		curr *= 2
	print(n // (curr - 1))


t = int(input())
for n in range(t):
	n = int(input())
	for k in range(2, 30):
		d = 2 ** k - 1
		if n % d:
			continue
		x = n / d
		break
	print(int(x))


t = int(input())
for i in range(0, t):
	n = int(input())
	t = 1
	for i in range(2, 100):
		if n / (2 ** i - 1) == n // (2 ** i - 1) and n / (2 ** i - 1) > 1:
			print(n // (2 ** i - 1))
			t = -1
			break
	if t != -1:
		print(1)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	x = 0
	k = 3
	while x == 0:
		if n % k == 0:
			x = 1
			print(n // k)
		else:
			k = (k + 1) * 2 - 1


for i in range(int(input())):
	s = int(input())
	k = 2
	c = 0
	x = 0
	while k <= s:
		if s % (2 ** k - 1) == 0:
			c = s // (2 ** k - 1)
			break
		k += 1
	print(c)


for q in range(int(input())):
	n = int(input())
	now = 1
	for i in range(1, 32):
		now += 2 ** i
		if n % now == 0:
			print(n // now)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	p = 3
	i = 3
	while n % p != 0:
		p += pow(2, i - 1)
		i += 1
	print(n // p)


n1 = int(input())
ansSet = []
while n1 != 0:
	n = int(input())
	i = 2
	Sum = 3
	while True:
		if n % Sum == 0:
			ans = int(n / Sum)
			ansSet.append(ans)
			break
		else:
			i = i + 1
			Sum = Sum + 2 ** (i - 1)
	n1 = n1 - 1
for num in ansSet:
	print(num)


for i in range(int(input())):
	k = int(input())
	j = 2
	while k % (2 ** j - 1) != 0:
		j += 1
	print(k // (2 ** j - 1))


T = int(input())
for t in range(T):
	n = int(input())
	val = 3
	while val <= n:
		temp = n / val
		if int(temp) == temp:
			print(int(temp))
			break
		val = val << 1 | 1


def func(n):
	n = n / 2
	k = 1.5
	two = 0.5
	while n / k - round(n / k, 0) != 0:
		n = n / 2
		two /= 2
		k += two
	return int(n / k)
n = int(input())
data = []
for _ in range(n):
	data.append(int(input()))
for i in data:
	print(func(i))


import math as mt
for _ in range(int(input())):
	n = int(input())
	k = 2
	while n % (mt.pow(2, k) - 1) != 0:
		k = k + 1
	print(round(n // (mt.pow(2, k) - 1)))


c = [int(2 ** x - 1) for x in range(2, 30 + 1)]
for _ in range(int(input())):
	n = int(input())
	for x in c:
		if n % x == 0:
			print(n // x)
			break


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	n = int(input())
	k = 2
	while k < 80:
		v = pow(2, k) - 1
		if n % v == 0:
			print(n // v)
			break
		k += 1
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


for q in range(int(input())):
	n = int(input())
	for i in range(2, 30):
		a = 2 ** i - 1
		if n % a == 0:
			print(n // a)
			break


t = input()
t = int(t)
for i in range(t):
	now = int(input())
	for k in range(2, 64):
		if now % (pow(2, k) - 1) == 0:
			print(now // (pow(2, k) - 1))
			break


def returnInt(n):
	i = 2
	while True:
		if n % int(2 ** i - 1) == 0:
			return n // int(2 ** i - 1)
		i += 1
t = int(input())
for i in range(t):
	n = int(input())
	ans = returnInt(n)
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	sum = 3
	ans = 0
	for i in range(2, n + 1):
		if n % sum == 0:
			ans = n // sum
			break
		else:
			sum = sum + 2 ** i
	print(ans)


a = int(input())
for i in range(a):
	b = int(input())
	c = 4
	d = c - 1
	while b % d:
		c *= 2
		d = c - 1
	print(b // d)


t = int(input())
for _ in range(t):
	n = int(input())
	r = 4
	for i in range(n):
		if n % (r - 1) == 0:
			print(n // (r - 1))
			break
		r *= 2


import math
t = int(input())
i = 0
while i < t:
	n = int(input())
	r = 0
	for k in range(2, int(math.log(n, 2)) + 2):
		r = (1 << k) - 1
		if n % r == 0:
			print(n // r)
			break
	i = i + 1


import sys
from array import array
input = sys.stdin.readline
arr = array('i', [3])
for i in range(1, 29):
	arr.append(arr[i - 1] + 2 ** (i + 1))
for i in range(int(input())):
	n = int(input())
	for j in arr:
		if n % j == 0:
			print(n // j)
			break


from math import log
t = int(input())
s = []
for i in range(t):
	n = int(input())
	for i in range(2, int(log(n, 2)) + 2):
		if n % (2 ** i - 1) == 0:
			s.append(int(n // (2 ** i - 1)))
			break
for i in s:
	print(i)


tests = int(input())
for test in range(tests):
	candies_number = int(input())
	k = 2
	while True:
		exponential = 2 ** k - 1
		k += 1
		if candies_number % exponential == 0:
			candies = candies_number // exponential
			print(candies)
			break


from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + '\n')
Ps = lambda x: stdout.write(str(x))
S = lambda x: x * (x + 1) // 2
I = lambda x: 1 + 2 * x
R = lambda : stdin.readline()
Ri = lambda x: map(int, x.split())
Rs = lambda x: map(str, x.split())
Rf = lambda x: map(float, x.split())
MaxN = 1 << 60

def f(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return 1
	return 0

def main():
	test = int(R())
	A = [3]
	i = 2
	while A[-1] < MaxN:
		A.append(A[-1] + (1 << i))
		i += 1
	for t in range(test):
		n = int(R())
		i = 0
		while n % A[i] != 0:
			i += 1
		Pi(n // A[i])
main()


test = int(input())
while test != 0:
	test = test - 1
	n = int(input())
	for k in range(2, 35):
		deno = 2 ** k - 1
		if n % deno:
			continue
		x = n / deno
		break
	print(int(x))


t = int(input())
for _ in range(t):
	num_wrap = int(input())
	c = 3
	p = 2
	while True:
		if num_wrap % c == 0:
			break
		else:
			c += 2 ** p
			p += 1
	print(int(num_wrap / c))


tc = int(input())
for _ in range(tc):
	num = int(input())
	i = 2
	while num % (2 ** i - 1) != 0:
		i += 1
	print(num // (2 ** i - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	cnt = 0
	exp = 0
	while True:
		cnt += 2 ** exp
		if n % cnt == 0 and cnt != 1:
			print(n // cnt)
			break
		exp += 1


a = []
i = 2
s = 3
while s < 10 ** 9 + 1:
	a.append(s)
	s += pow(2, i)
	i += 1
for _ in range(int(input())):
	n = int(input())
	for i in a:
		if n % i == 0:
			print(n // i)
			break


tests = int(input())
for test in range(tests):
	n = int(input())
	k = 3
	while n % k > 0:
		k = 1 + 2 * k
	print(n // k)


t = int(input())
sx = [1]
for i in range(1, 64):
	sx.append(sx[-1] + 2 ** i)
for _ in range(t):
	n = int(input())
	for k in sx[1:]:
		if n % k == 0:
			print(int(n / k))
			break


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
from math import gcd
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
t = inp(1)
while t:
	t -= 1
	n = inp(1)
	for k in range(2, 30):
		q = n % ((1 << k) - 1)
		if q == 0:
			print(n // ((1 << k) - 1))
			break


t = int(input())
powers = [1]
for x in range(30):
	powers.append(powers[-1] * 2)
for x in range(1, 31):
	powers[x] += powers[x - 1]
for _ in range(t):
	n = int(input())
	for x in range(1, 31):
		if n % powers[x] == 0:
			print(n // powers[x])
			break


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def abs(x):
	return x if x >= 0 else -x

def sumelem(x, start, end):
	sum = 0
	for i in range(start, end + 1):
		sum += x[i]
	return sum
for t in range(int(input())):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			break
		else:
			k += 1
	print(n // (2 ** k - 1))


import math
t = int(input())
while t != 0:
	n = int(input())
	k = 1
	while True:
		k += 1
		deno = math.pow(2, k) - 1
		if n % deno != 0:
			continue
		x = n // deno
		break
	print(int(x))
	t -= 1


import sys
input = sys.stdin.readline
X = [3]
for i in range(40):
	X.append(X[-1] + 2 ** (i + 2))
t = int(input())
for tests in range(t):
	n = int(input())
	for x in X:
		if n % x == 0:
			print(n // x)
			break


for _ in range(int(input())):
	N = int(input())
	for i in range(2, len(bin(N)) - 1):
		if N % int('1' * i, 2) == 0:
			print(N // int('1' * i, 2))
			break


for _ in range(int(input())):
	num = int(input())
	for i in range(2, 30):
		if num % (2 ** i - 1) == 0:
			print(num // (2 ** i - 1))
			break


t = int(input())
for i in range(t):
	s = int(input())
	for j in range(2, 30, 1):
		if s % (2 ** j - 1) == 0:
			print(s // (2 ** j - 1))
			break
		else:
			continue


def solve(n):
	k = 2
	while True:
		a = float(n % (2 ** k - 1))
		if a == 0:
			return int(n / (2 ** k - 1))
			break
		else:
			k += 1
t = int(input())
out = []
for j in range(t):
	n = int(input())
	out.append(solve(n))
for item in out:
	print(item)


T = int(input())
for i in range(T):
	Sum = int(input())
	k = 2
	while k < 30:
		r = Sum / (2 ** k - 1)
		if r.is_integer() == True:
			print(int(r))
			break
		else:
			k = k + 1


def series(n):
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)
t = int(input())
for _ in range(t):
	n = int(input())
	print(series(n))


for f in range(int(input())):
	n = int(input())
	k = 3
	while n % k != 0:
		k = k * 2 + 1
	print(n // k)


for tc in range(0, int(input())):
	n = int(input())
	found = False
	factor = 2 ** 1
	sum_ = 3
	while not found:
		if n % sum_ == 0:
			found = True
			break
		factor *= 2
		sum_ += factor
	print(n // sum_)


n = int(input())
a = [0] * n
for i in range(n):
	a[i] = int(input())

def search(k):
	x = 0
	for i in range(2, 40):
		p = 2 ** i - 1
		if k % p == 0:
			x = k // p
			break
	return x
ans = [0] * n
for i in range(n):
	ans[i] = search(a[i])
for i in range(n):
	print(ans[i])


for h in [*open(0)][1:]:
	(n, k) = (int(h), 3)
	while n % k:
		k -= ~k
	print(n // k)


for _ in range(int(input())):
	n = int(input())
	i = 2
	while True:
		x = n / (2 ** i - 1)
		if int(x) == x:
			print(int(x))
			break
		i += 1


from sys import stdin, exit, setrecursionlimit
from collections import deque
setrecursionlimit(10000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
powers = [1]
for i in range(32):
	powers.append(powers[-1] * 2)
for _ in range(int(input())):
	a = int(input())
	for i in range(2, 33):
		if a % (powers[i] - 1) == 0:
			print(a // (powers[i] - 1))
			break


for _ in range(int(input())):
	n = int(input())
	s = 3
	k = 2
	if n % s == 0:
		print(n // s)
		continue
	while s < n:
		k += 1
		s = 2 ** k - 1
		if n % s == 0:
			print(n // s)
			break


import sys
import math

def scan(input_type='int'):
	if input_type == 'int':
		return list(map(int, sys.stdin.readline().strip().split()))
	else:
		return list(map(str, sys.stdin.readline().strip()))

def solution():
	for _ in range(int(input())):
		n = int(input())
		i = 4
		while True:
			x = n / (i - 1)
			y = n // (i - 1)
			i *= 2
			if x == y:
				break
		print(y)
solution()


for _ in range(int(input())):
	n = int(input())
	j = 2
	x = 3
	while n % x != 0:
		x = x + 2 ** j
		j = j + 1
	print(n // x)


for _ in range(int(input())):
	n = int(input())
	(x, k) = (0, 0)
	for i in range(2, 32 + 1):
		temp = 2 ** i
		temp -= 1
		if n % temp == 0:
			k = i
			x = n // temp
			break
	print(x)


for _ in range(int(input())):
	n = int(input())
	a = 3
	while n % a is not 0:
		a = a << 1 | 1
	print(n // a)


from sys import stdin
from math import pow

def main():
	r = stdin.readline
	cases = int(r())
	for case in range(cases):
		n = int(r())
		k = 1
		while n % (int(pow(2, k + 1)) - 1) != 0:
			k += 1
		print(n // int(pow(2, k + 1) - 1))
main()


t = int(input())
for i in range(t):
	n = int(input())
	j = 2
	while True:
		y = n / (2 ** j - 1)
		if int(y) == y:
			print(int(y))
			break
		else:
			j += 1


t = int(input())
l = []
for x in range(t):
	n = int(input())
	x = -1
	total = 1
	k = 2
	while x == -1:
		total += 2 ** (k - 1)
		if n % total == 0:
			x = n // total
			l.append(x)
		k += 1
for x in l:
	print(x)


t = int(input())
for t_itr in range(0, t):
	n = int(input())
	i = 2
	p = 3
	ans = 1
	found = 0
	while p < n:
		if n % p == 0:
			found = 1
			ans = n // p
			break
		i += 1
		p = pow(2, i) - 1
	print(ans)


T = int(input())
for _ in range(T):
	n = int(input())
	i = 4
	j = 2
	while i <= n + 1:
		if n % (i - 1) == 0:
			print(n // (i - 1))
			break
		j += 1
		i = 2 ** j


def func(n):
	x = 1
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		k += 1
for _ in range(int(input())):
	n = int(input())
	func(n)


t = int(input())
for case in range(t):
	n = int(input())
	for k in range(1, n):
		x = n / (2 ** (k + 1) - 1)
		if x.is_integer():
			print(int(x))
			break
		k += 1


def main():
	n = int(input())
	k = 2
	s = 3
	while True:
		if n % s == 0:
			print(n // s)
			return
		else:
			k *= 2
			s += k
for _ in range(int(input())):
	main()


import math
t = int(input())
for a0 in range(t):
	n = int(input())
	x = 2
	xx = 3
	z = True
	while z:
		if n % xx == 0:
			y = n / xx
			if int(y) == y:
				print(int(y))
				z = False
		x += 1
		xx = 2 ** x - 1


s = 1
a = []
for i in range(1, 32):
	s += 2 ** i
	a.append(s)
for t in range(int(input())):
	n = int(input())
	for i in a:
		if n % i == 0:
			ans = n // i
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	hh = 2
	while int(n / (2 ** hh - 1)) != n / (2 ** hh - 1):
		hh += 1
	print(n // (2 ** hh - 1))


T = int(input())
for _ in range(T):
	n = int(input())
	f = 3
	while True:
		if n % f == 0:
			print(n // f)
			break
		else:
			f = 2 * f + 1


import math

def find(n):
	for k in range(2, int(math.log2(n + 1) + 1)):
		result = n / (2 ** k - 1)
		if result == round(result):
			print(int(result))
			return
t = int(input())
for i in range(t):
	n = int(input())
	find(n)


l = [0 for i in range(30)]
l[2] = 4
for i in range(3, 30):
	l[i] = l[i - 1] * 2
t = int(input())
for i in range(t):
	n = int(input())
	for i in range(2, 30):
		if n % (l[i] - 1) == 0:
			print(n // (l[i] - 1))
			break


import math
t = int(input())
for i in range(t):
	n = int(input())
	sum1 = 1
	for j in range(1, int(math.sqrt(n) + 1)):
		sum1 = sum1 + pow(2, j)
		if n % sum1 == 0 and sum1 != 0:
			print(int(n / sum1))
			break


for i in range(int(input())):
	n = int(input())
	k = 2
	while True:
		arr_sum = n / (pow(2, k) - 1)
		if arr_sum == n // (pow(2, k) - 1) and arr_sum > 0:
			print(int(arr_sum))
			break
		k += 1


def solve(n):
	i = count = 1
	while count < n:
		count += pow(2, i)
		if n % count == 0:
			return n // count
		i += 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))
assert solve(3) == 1
assert solve(6) == 2
assert solve(7) == 1
assert solve(21) == 7
assert solve(28) == 4
assert solve(999999999) == 333333333
assert solve(999999984) == 333333328


import math

def solve():
	n = int(input())
	s = 1
	for k in range(2, 1000000000):
		s += 2 ** (k - 1)
		if n % s == 0:
			print(int(n / s))
			break

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
l = []
for i in range(t):
	n = int(input())
	for k in range(2, n + 1):
		if not n % (pow(2, k) - 1):
			print(n // (pow(2, k) - 1))
			break


import math
arr = []
for i in range(2, 1000):
	arr.append(math.pow(2, i) - 1)
cases = int(input())
while cases:
	number = int(input())
	for j in range(0, 1000):
		if number % arr[j] == 0:
			print(int(number / arr[j]))
			break
	j = 0
	cases = cases - 1


t = int(input())
for i in range(t):
	n = int(input())
	now = 3
	for i in range(10 ** 5):
		if n % now == 0:
			print(n // now)
			break
		else:
			now += 2 ** (i + 2)


import math
import sys
t = int(input())
for index in range(t):
	n = int(input())
	k = 2
	while True:
		sum = int(math.pow(2, k) - 1)
		if n % sum == 0:
			break
		k += 1
	x = int(n / sum)
	print(x)


from math import log2, ceil
for _ in range(int(input())):
	N = int(input())
	for i in range(2, int(ceil(log2(N))) + 1):
		if N % (2 ** i - 1) == 0:
			print(int(N / (2 ** i - 1)))
			break


t = int(input())
while t > 0:
	n = int(input())
	k = 2
	while pow(2, k) - 1 <= n:
		ans = n / (pow(2, k) - 1)
		if ans == int(ans):
			print(int(ans))
			break
		k = k + 1
	t = t - 1


def btod(n):
	return int(n, 2)

def bs(n):
	num = '11'
	while True:
		if n % btod(num) == 0:
			return n // btod(num)
		num += '1'

def solve():
	n = int(input())
	num = bs(n)
	print(num)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	div = 3
	while n % div != 0:
		div = 2 * div + 1
	print(n // div)


for i in range(int(input())):
	n = int(input())
	k = 2
	x = n
	while k <= 29:
		if not n % (2 ** k - 1):
			x = n // (2 ** k - 1)
			break
		k += 1
	print(x)


import math

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
for _ in range(ii()):
	n = int(input())
	j = 1
	if n < 3:
		print(n)
		continue
	else:
		for i in range(1, n + 1):
			j += 2 ** i
			if n % j == 0:
				print(n // j)
				break


def solve():
	n = int(input())
	d = 3
	nd = 4
	while n % d != 0:
		d += nd
		nd *= 2
	print(n // d)
t = int(input())
for _ in range(t):
	solve()


q = int(input())
while q > 0:
	q -= 1
	x = int(input())
	for i in range(1, 33):
		if x % ((1 << i + 1) - 1) == 0:
			print(x // ((1 << i + 1) - 1))
			break


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

def LIST():
	return list(map(int, input().split()))

def STR():
	return input()

def MAP():
	return map(int, input().split())
for _ in range(INT()):
	n = INT()
	summ = 0
	ans = [1, 2]
	i = 2
	while n % sum(ans) != 0:
		ans.append(2 ** i)
		i += 1
	print(int(n / sum(ans)))


from cmath import log
import sys, threading
input = sys.stdin.readline

def print(*args, end='\n', sep=' ') -> None:
	sys.stdout.write(sep.join(map(str, args)) + end)

def Solve():
	for t in range(int(input())):
		n = int(input())
		for i in range(2, n):
			x = n / (2 ** i - 1)
			if int(x) == x:
				print(int(x))
				break
threading.stack_size(10 ** 5)
threading.Thread(target=Solve).start()


a = int(input())
for i in range(a):
	numbertested = int(input())
	currentValue = 1
	currenttwo = 2
	while True:
		currentValue = currentValue + currenttwo
		currenttwo *= 2
		if numbertested % currentValue == 0:
			print(int(numbertested / currentValue))
			break


def solve():
	n = int(input())
	for i in range(2, 10000):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
	return

def main():
	t = int(input())
	for i in range(t):
		solve()
	return
main()


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	k = [1]
	sum_k = [1]
	while k[-1] < 10 ** 9:
		k.append(k[-1] * 2)
		sum_k.append(sum_k[-1] + k[-1])
	for _ in range(int(input())):
		n = int(input())
		for i in sum_k[1:]:
			if n % i == 0:
				print(n // i)
				break
solution()


t = int(input())
for i in range(t):
	n = int(input())
	if n == 3:
		print(1)
	else:
		twodegk = 4
		while n % (twodegk - 1) != 0:
			twodegk *= 2
		print(n // (twodegk - 1))


def getClosest(number):
	index = 1
	pointer = 1
	for i in range(2, 10 ** 9):
		pointer += 2 ** (i - 1)
		if pointer > 1 and number % pointer == 0:
			index = pointer
			break
	return index
t = int(input())
for i in range(t):
	n = int(input())
	k = getClosest(n)
	x = n // k
	print(x)


for _ in range(0, int(input())):
	n = int(input())
	ans = 1
	x = 4
	while x <= n:
		if n % (x - 1) == 0:
			ans = n // (x - 1)
			break
		else:
			x *= 2
	print(ans)


t = int(input())
for i in range(t):
	wrappers = int(input())
	number = 3
	exp = 1
	while wrappers % number != 0:
		exp += 1
		number += 2 ** exp
	print(int(wrappers / number))


length = int(input())

def answer(n):
	k = 3
	if not n % 3:
		return n / 3
	s = 4
	while k < n:
		k += s
		if not n % k:
			return n / k
		s *= 2
while length:
	print(int(answer(int(input()))))
	length -= 1


ks = [2 ** i - 1 for i in range(2, 30)]
o = []
for i in [0] * int(input()):
	n = int(input())
	for j in ks:
		if n % j == 0:
			o.append(int(n / j))
			break
[print(i) for i in o]


def fast_power2(base, power):
	result = 1
	while power > 0:
		if power % 2 == 1:
			result = result * base
		power = power // 2
		base = base * base
	return result

def sigma(k):
	return fast_power2(2, k) - 1
for _ in range(int(input())):
	n = int(input())
	k = 1
	c = 3
	while c <= n:
		if n % c == 0:
			print(n // c)
			break
		else:
			k += 1
			c = sigma(k)


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3)
	else:
		l = 2
		t = 3
		while n % (t + 2 * l) != 0:
			l = 2 * l
			t += l
		print(n // (t + 2 * l))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		i = 2
		k = 2 ** i - 1
		while n % k != 0:
			i += 1
			k = 2 ** i - 1
		else:
			x = n // k
		print(x)
main()


for _ in range(int(input())):
	n = int(input())
	for k in range(2, 10 ** 8):
		if (n / (2 ** k - 1)).is_integer():
			print(int(n / (2 ** k - 1)))
			break


for _ in range(int(input())):
	indice = 2
	atual = 3
	caso = int(input())
	while True:
		if caso % atual == 0:
			break
		atual = atual + 2 ** indice
		indice += 1
	print(caso // atual)


import math
for ad in range(int(input())):
	n = int(input())
	c = 0
	for i in range(2, int(math.log(2)) + 500):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


t = int(input())
while t > 0:
	m = int(input())
	p = 2
	while True:
		n = int(pow(2, p)) - 1
		if m % n == 0:
			sum = int(m / n)
			break
		p += 1
	print(sum)
	t = t - 1


from math import floor, ceil
for _ in range(int(input())):
	n = int(input())
	sum = 1
	k = 1
	while 1:
		sum += pow(2, k)
		x = n / sum
		if floor(x) == ceil(x):
			print(n // sum)
			break
		k += 1


t = int(input())
y = list()
d = 2
for x in range(0, 30):
	d = d << 1
	y.append(d - 1)
for x in range(0, t):
	n = int(input())
	for x in y:
		if n / x == n // x:
			print(n // x)
			break


def solver(n):
	k = 2
	while True:
		x = n // (2 ** k - 1)
		if n % (2 ** k - 1) == 0:
			return x
		else:
			k += 1
t = int(input())
for i in range(t):
	n = int(input())
	print(solver(n))


def calX(n, k):
	x = n // (pow(2, k) - 1)
	return x
t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 100):
		if n % (pow(2, k) - 1) == 0:
			x = calX(n, k)
			print(x)
			break


def solve():
	n = int(input())
	x = 1
	for k in range(2, 30):
		fact = pow(2, k) - 1
		if n % fact == 0:
			print(n // fact)
			return
t = int(input())
while t > 0:
	solve()
	t -= 1


import collections
from math import log2

def solve(n):
	curr = 1
	s = 1
	for i in range(32):
		s += 2 ** curr
		curr += 1
		if n % s == 0:
			return n // s
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	print(solve(n))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	k = 4
	while k - 1 <= n:
		if n % (k - 1) == 0:
			break
		k *= 2
	print(n // (k - 1))


t = int(input(''))
list1 = []
for i in range(0, t):
	a = True
	k = 2
	n = int(input(''))
	while a == True:
		if n % (2 ** k - 1) == 0:
			list1.append(int(n / (2 ** k - 1)))
			a = False
		elif n % (2 ** k - 1) != 0:
			k += 1
for j in list1:
	print(j)


inputSize = int(input())
inps = []
for i in range(inputSize):
	inps.append(int(input()))
for n in inps:
	k = 2
	total = 3
	while n % total != 0:
		total += 2 ** k
		k += 1
	print(n // total)


def solve():
	n = int(input())
	s = 3
	a = 2
	while True:
		if n % s == 0:
			print(n // s)
			break
		else:
			a *= 2
			s += a

def main():
	t = int(input())
	for i in range(t):
		solve()
main()


test = int(input())
for _ in range(test):
	n = int(input())
	for i in range(2, 60):
		if n % ((1 << i) - 1) == 0:
			print(n // ((1 << i) - 1))
			break


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	n = len(l)
L = []
i = 0
while 2 ** i < 10 ** 9 + 1:
	L.append(2 ** i)
	i += 1
T = int(input())
for _ in range(T):
	n = int(stdin.readline())
	for i in range(2, len(L)):
		if n % (L[i] - 1) == 0:
			print(n // (L[i] - 1))
			break


import sys

def f(x, k):
	su = 0
	ii = 1
	for i in range(k):
		su += x * ii
		ii = ii * 2
	return su
s = []
for i in range(28):
	s.append(f(1, i + 2))
data = list(map(int, sys.stdin.readlines()))
for i in range(data[0]):
	ip = data[i + 1]
	for j in range(28):
		if not ip % s[j]:
			print(ip // s[j])
			break


t = int(input())
for i1 in range(t):
	n = int(input())
	a = 2
	result = None
	while True:
		a *= 2
		if n // (a - 1) == n / (a - 1):
			result = n // (a - 1)
			break
	print(result)


import math

def isprime(a):
	for i in range(2, int(math.sqrt(a) + 1)):
		if a % i == 0:
			return False
	return True
for t in range(int(input())):
	n = int(input())
	if isprime(n):
		print(1)
		continue
	k = 2
	f = False
	while f == False:
		if n % (2 ** k - 1) == 0 and f == False:
			print(n // (2 ** k - 1))
			f = True
		k += 1


def Function():
	n = int(input())
	k = 1
	while True:
		k += 1
		if (n / (2 ** k - 1)).is_integer():
			print(n // (2 ** k - 1))
			return
for i in range(int(input())):
	Function()


def candies(n):
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			return int(n / (2 ** k - 1))
		k += 1
t = int(input())
for t_itr in range(t):
	n = int(input())
	result = candies(n)
	print(result)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	for k in range(2, 31):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(2, 35):
		d = 2 ** j - 1
		if n % d != 0:
			continue
		else:
			x = n // d
			print(x)
			break


T = int(input())
for t in range(T):
	n = int(input())
	k = 1
	V_k = 1
	while True:
		if k > 1 and n // V_k == n / V_k:
			x = int(n / V_k)
			print(x)
			break
		else:
			k += 1
			V_k += 2 ** (k - 1)


f = []
y = 4
while y < 10 ** 9:
	f.append(y - 1)
	y *= 2
for _ in range(int(input())):
	n = int(input())
	for y in f:
		if n % y == 0:
			print(n // y)
			break


import sys
stream = sys.stdin
t = int(stream.readline())
for n in stream:
	n = int(n)
	k = 2
	while 2 ** k - 1 <= n:
		div_result = n / (2 ** k - 1)
		if abs(div_result - int(div_result)) < 1e-12:
			print(int(div_result))
			break
		k += 1


for _ in range(int(input())):
	n = int(input())
	x = 1
	k = 1
	ans = 1
	if n != 1:
		while True:
			x += 2 ** k
			if x == n or n % x == 0:
				ans = n // x
				break
			k += 1
		print(ans)
	else:
		print(ans)


for i in range(int(input().strip())):
	n = int(input().strip())
	k = 2
	while True:
		x = n % (2 ** k - 1)
		if x == 0:
			print(int(n / (2 ** k - 1)))
			break
		else:
			k += 1


T = int(input())
for j in range(T):
	n = int(input())
	for i in range(2, 10000):
		x = pow(2, i) - 1
		if n % x == 0:
			print(n // x)
			break


a = int(input())
h = []
for i in range(0, a):
	x = int(input())
	res = 0
	for i in range(2, 30):
		if x % (2 ** i - 1) == 0:
			res = int(x / (2 ** i - 1))
			break
		else:
			i += 1
	h.append(res)
print(*h, sep='\n')


import math

def isint(k):
	return k == int(k)

def process():
	n = int(input())
	p = math.ceil(math.log(n, 2))
	for k in range(2, p + 1):
		ratio = n / (2 ** k - 1)
		if isint(ratio):
			return int(ratio)
	return -1
for _ in range(int(input())):
	print(process())


k = 1
kq = [1]
while k < 1000000001:
	k *= 2
	kq.append(k + kq[-1])
kq.pop(0)
T = int(input())
for tc in range(T):
	x = int(input())
	for i in kq:
		if x % i == 0:
			print(x // i)
			break


tc = int(input())
for _ in range(tc):
	n = int(input())
	d = 3
	while n % d != 0:
		d = 2 * d + 1
	print(n // d)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 3 == 0:
		print(int(n / 3))
	elif n % 7 == 0:
		print(int(n / 7))
	elif n % 15 == 0:
		print(int(n / 15))
	elif n % 31 == 0:
		print(int(n / 31))
	elif n % 63 == 0:
		print(int(n / 63))
	elif n % 127 == 0:
		print(int(n / 127))
	else:
		val = 255
		count = 256
		while 1:
			if n % val == 0:
				print(int(n / val))
				break
			val += count
			count *= 2


for _ in range(int(input())):
	n = int(input())
	i = 3
	j = 2
	while n % i:
		i += 2 ** j
		j += 1
	ans = n // i
	print(ans)


for T in range(int(input())):
	n = int(input())
	v = 3
	rem = n % 3
	x = 3
	while rem:
		v = 2 ** x - 1
		rem = n % v
		x += 1
	x = n // v
	print(x)


def main():
	t = int(input())
	for o in range(t):
		n = int(input())
		i = 2
		while True:
			a = 2 ** i - 1
			i += 1
			if n % a == 0:
				print(int(n / a))
				break
main()


def main():
	T = int(input())
	A = [2 ** i - 1 for i in range(2, 32)]
	for _ in range(T):
		N = int(input())
		for a in A:
			if N % a == 0:
				print(N // a)
				break
main()


test = int(input())
while test > 0:
	n = int(input())
	for i in range(2, 10 ** 9):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
	test -= 1


cases = int(input())
for case in range(cases):
	n = int(input())
	k = 3
	for k in range(2, 35):
		if n % (2 ** k - 1) == 0:
			print(int(n / (2 ** k - 1)))
			break


t = int(input())
for tt in range(t):
	n = int(input())
	i = 3
	j = 2
	while i <= n:
		j = j * 2
		if n % i == 0:
			print(round(n / i))
			break
		i = i + j


ns = [int(input()) for i in range(int(input()))]
for n in ns:
	k = 2
	s = 3
	while True:
		if n % s == 0:
			x = int(n / s)
			print(x)
			break
		else:
			k += 1
			s += 2 ** (k - 1)


def out(n):
	k = 2
	while n % (2 ** k - 1):
		k = k + 1
	print(n // (2 ** k - 1))
x = int(input())
for i in range(x):
	n = int(input())
	out(n)


n = int(input())
ans = []
for i in range(n):
	ele = int(input())
	for i in range(2, 40):
		pw = 2 ** i - 1
		if ele % pw == 0:
			k = ele / pw
			ans.append(int(k))
			break
for ele in ans:
	print(ele, end='\n')


t = int(input())
for i in range(t):
	n = int(input())
	k = 1
	while 1:
		k += 1
		y = n / (2 ** k - 1)
		z = n // (2 ** k - 1)
		if y == z:
			print(z)
			break


numt = int(input())
for fr in range(numt):
	total = int(input())
	count = 0
	sum_x = 1
	while True:
		count += 1
		sum_x = sum_x + 2 ** count
		if total / sum_x == total // sum_x:
			print(int(total / sum_x))
			break


t = int(input())
for k in range(t):
	n = int(input())
	ans = 1
	c = 0
	x = 0
	while 1:
		c += 1
		x = 2 ** c
		ans = ans + x
		if n % ans == 0:
			a = n // ans
			break
	print(a)


t = int(input())
NUM = []
for i in range(t):
	n = int(input())
	m = n
	d = 3
	k = 2
	while m != 1:
		if m % d == 0:
			NUM.append(m // d)
			break
		else:
			d += 2 ** k
			k += 1
for i in range(t):
	print(NUM[i])


for itr in range(int(input())):
	n = int(input())
	for i in range(2, n):
		s = 2 ** i - 1
		x = n / s
		if x == int(x):
			print(int(x))
			break


import sys
import math
import heapq
from collections import defaultdict, deque
input = sys.stdin.readline

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
for _ in range(r()):
	n = r()
	i = '11'
	while n % int(i, 2) != 0:
		i += '1'
	print(n // int(i, 2))


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = 0
	k = 3
	p = 2
	while x == 0:
		if n % k == 0:
			x = 1
			print(n // k)
		else:
			k += 2 ** p
			p += 1


t = int(input())
for i in range(0, t):
	n = float(input())
	k = 2
	result = n / (2 ** k - 1)
	while result % 1 != 0.0:
		k += 1
		result = n / (2 ** k - 1)
	print(int(result))


def candies(n):
	for i in range(3, 50):
		if n % (2 ** (i - 1) - 1) == 0:
			return n // (2 ** (i - 1) - 1)
	else:
		return 1
t = int(input())
for i in range(t):
	print(candies(int(input())))


def solve(d):
	n = 2
	while True:
		if d % (2 ** n - 1) == 0:
			sol = d // (2 ** n - 1)
			return sol
		else:
			n += 1
test_cases = int(input())
for i in range(test_cases):
	d = int(input())
	print(str(solve(d)))


def fun(s):
	i = 2
	while True:
		x = pow(2, i) - 1
		if s % x == 0:
			print(s // x)
			return
		i += 1
for T in range(int(input())):
	s = int(input())
	fun(s)


l = []
for i in range(2, 35):
	l.append(2 ** i - 1)
for nt in range(int(input())):
	n = int(input())
	flag = 0
	for i in l:
		if n % i == 0:
			print(n // i)
			flag = 1
			break


from collections import defaultdict
from collections import Counter
from string import ascii_lowercase
import math
from sys import setrecursionlimit as srl
srl(2 * 10 ** 6)

def solve(n):
	x = 0
	for i in range(2, 36):
		p = 2 ** i - 1
		if n % p:
			continue
		x = n // p
		break
	return x
t = int(input())
while t:
	n = int(input())
	print(solve(n))
	t -= 1


def any():
	n = int(input())
	for k in range(2, 30):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
for t in range(int(input())):
	any()


x = 10 ** 7
t = int(input())
for i in range(t):
	s = 1
	p = 2
	n = int(input())
	for f in range(x):
		s += p
		p *= 2
		if n % s == 0:
			print(n // s)
			break


t = int(input())
for i in range(1, t + 1):
	k1 = 3
	k = 2
	n = int(input())
	while n % k1 != 0:
		k1 += 2 ** k
		k += 1
	x = n // k1
	print(x)


n = int(input())
for i in range(0, n):
	m = int(input())
	(temp, j) = (0, 2)
	while temp <= m:
		temp = 2 ** j - 1
		if m % temp == 0:
			print(m // temp)
			break
		j += 1


t = int(input())
for _ in range(t):
	n = int(input())
	flag = False
	i = 1
	x = 1
	while flag == False:
		x = x + 2 ** i
		if n % x == 0:
			print(n // x)
			flag = True
		i = i + 1


t = int(input())
for test in range(t):
	n = int(input())
	k = 2
	while 1:
		value = 2 ** k - 1
		if n % value == 0:
			print(n // value)
			break
		else:
			k += 1


import math
from decimal import *
getcontext().prec = 30
t = int(input())
while t:
	t -= 1
	n = int(input())
	k = 2
	while 1:
		z = pow(2, k) - 1
		if n % z == 0:
			print(n // z)
			break
		k += 1


import math
for _ in range(int(input())):
	n = int(input())
	for i in range(2, math.ceil(math.log(n, 2)) + 1):
		if n // (2 ** i - 1) == n / (2 ** i - 1):
			print(n // (2 ** i - 1))
			break


def gp(k):
	return 2 ** k - 1
for t in range(int(input())):
	t = int(input())
	k = 2
	while (t / gp(k)).is_integer() == False:
		k += 1
	print(int(t / gp(k)))


n = int(input())
for _ in range(n):
	i = 2
	s = 3
	num = int(input())
	while not num % s == 0:
		s += 2 ** i
		i += 1
	print(num // s)


n = 2
su = 3
l = []
while su <= 10 ** 9:
	l.append(su)
	n = 2 * n
	su += n
we = len(l)
t = int(input())
for _ in range(t):
	w = int(input())
	for i in range(we):
		if w % l[i] == 0:
			print(w // l[i])
			break


dp = []
MAX = 10 ** 9

def getmultipleof2():
	k = 2
	num = 2
	while num < MAX:
		num = 2 * k
		k = num
		dp.append(num)
getmultipleof2()
t = int(input())
while t:
	t -= 1
	n = int(input())
	for num in dp:
		if n // (num - 1) == n / (num - 1):
			print(n // (num - 1))
			break


queries = int(input())
for _ in range(queries):
	number = int(input())
	current = number - 1
	for power in range(2, 30):
		result = 2 ** power - 1
		if number % result == 0:
			print(number // result)
			break


import math, sys

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def ii():
	return int(input())

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = ii()
for _ in range(t):
	n = ii()
	k = 1
	while n % (int(math.pow(2, k + 1)) - 1) != 0:
		k = k + 1
	print(n // (int(math.pow(2, k + 1)) - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	k = 4
	while k < n * 2:
		test = n / (k - 1) == n // (k - 1)
		if test:
			print(n // (k - 1))
			break
		else:
			k *= 2


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		for k in range(2, n):
			a = 2 ** k - 1
			if n % a == 0:
				print(int(n // a))
				break
except:
	pass


t = int(input())
for i in range(t):
	n = int(input())
	m = 2
	x = -1 * n / (1 - 2 ** m)
	while abs(int(x)) - x != 0:
		x = -1 * n / (1 - 2 ** m)
		m += 1
	print(int(x))


def find_num(n):
	temp = n
	degr = 4
	while temp > 0:
		check = n / (degr - 1)
		if check == int(check):
			return int(check)
		degr = degr * 2
t = int(input())
for _ in range(t):
	n = int(input())
	print(find_num(n))


def op():
	n = int(input())
	i = 4
	while n > i - 5:
		if n % (i - 1) == 0:
			print(n // (i - 1))
			return 0
		i *= 2
	return 0
n = int(input())
for i in range(n):
	op()


import fileinput
t = int(input())
for i in range(t):
	n = int(input())
	k = 2
	k_sum = 3
	while k_sum <= n:
		if n % k_sum == 0:
			print(n // k_sum)
			break
		k_sum = 2 * k_sum + 1


import math
t = int(input())
while t > 0:
	t -= 1
	x = -1
	n = int(input())
	k = int(math.log(n + 1, 2))
	for i in range(2, k + 1):
		fac = pow(2, i) - 1
		if n % fac == 0:
			x = int(n / fac)
			break
	print(x)


def check(n, k):
	val = 1
	sum = 0
	for _ in range(k):
		sum += val
		val *= 2
	if n % sum == 0:
		return n // sum
	return -1
t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	k = 2
	while 1 != 0:
		aux = check(n, k)
		if aux != -1:
			print(aux)
			break
		k += 1


for _ in range(int(input())):
	wrappers = int(input())
	k = 2
	while wrappers % (2 ** k - 1) > 0:
		k += 1
	print(wrappers // (2 ** k - 1))


def main():
	from sys import stdout
	n = int(input())
	lis = [1]
	while lis[len(lis) - 1] < 10 ** 9 + 1:
		lis.append(lis[len(lis) - 1] + 2 ** len(lis))
	for i in range(n):
		inp = int(input())
		for el in lis[1:]:
			if inp % el == 0:
				stdout.write(str(int(inp / el)) + '\n')
				break
main()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import time, random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	na = [I() for _ in range(t)]
	ii = [2 ** i - 1 for i in range(2, 40)]
	rr = []
	for n in na:
		for i in ii:
			if n % i == 0:
				rr.append(n // i)
				break
	return JA(rr, '\n')
print(main())


m = int(input())
for i in range(1, m + 1):
	n = int(input())
	for k in range(2, 100):
		x = n / (2 ** k - 1)
		if n % (2 ** k - 1) == 0:
			print('%d' % x)
			break


t = int(input())

def func(n, k):
	return n / (2 ** k - 1)
for i in range(t):
	n = int(input())
	b = 0
	k = 2
	while b != 1:
		c = func(n, k)
		if int(c) == c:
			print(int(c))
			b = 1
		k += 1


t = int(input())
for _ in range(t):
	test = 3
	n = int(input())
	while True:
		if n % test == 0:
			print(int(n / test))
			break
		test = 2 * test + 1


import sys
import math
import bisect

def solve(n):
	k = 2
	while True:
		val = 2 ** k - 1
		if n % val == 0:
			x = n // val
			return x
		k += 1
	return -1

def main():
	for _ in range(int(input())):
		n = int(input())
		print(solve(n))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, 30):
		outout = n / (2 ** i - 1)
		if outout % 1 == 0:
			print(int(outout))
			break


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	for i in range(2, n):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


a = input()
for i in range(int(a)):
	n = int(input())
	for k in range(2, 500000000):
		if not n % (2 ** k - 1):
			print(int(n / (2 ** k - 1)))
			break


t = int(input())
for i in range(t):
	n = int(input())
	step = 1
	a = 0
	while 1 == 1:
		a += step
		step *= 2
		if n % a == 0 and a > 1:
			x = n / a
			break
	print(int(x))


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	flag = []
	for i in range(10 ** 9):
		s += 2 ** i
		if n % s == 0 and s > 1:
			print(n // s)
			break
		elif n == 1:
			print(n)
			break
		elif n == 2:
			print(n)
			break


import math as m
x = int(input())
for i in range(x):
	n = int(input())
	k = m.floor(m.log2(n + 1))
	for i in range(2, k + 1):
		if n % (pow(2, i) - 1) == 0:
			print(n // (pow(2, i) - 1))
			break


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		found = 0
		k = 2
		while not found:
			x = n // (2 ** k - 1)
			if x == n / (2 ** k - 1):
				print(x)
				found = 1
			k += 1
main()


def case():
	n = int(input())
	is_int = lambda x: int(x) == x
	two_k = 4
	while True:
		x = n / (two_k - 1)
		if is_int(x):
			print(f'{int(x)}')
			return
		two_k *= 2

def main():
	tc = int(input())
	for i in range(tc):
		case()
main()


t = int(input())
possible = [pow(2, a) - 1 for a in range(2, 100)]
for i in range(t):
	num = int(input())
	for a in range(len(possible)):
		if num % possible[a] == 0:
			print(num // possible[a])
			break


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	k = 2
	while True:
		d = 2 ** k - 1
		if n % d == 0:
			print(n // d)
			break
		k += 1


from time import time

def main():
	t = int(input())
	incomplete_sum = 1
	sums = set()
	power = 2
	while power < 1000000000:
		incomplete_sum += power
		power *= 2
		sums.add(incomplete_sum)
	for _ in range(t):
		n = int(input())
		for k in sums:
			if n % k == 0:
				print(n // k)
				break
main()


t = input()
t = int(t)
while t != 0:
	n = input()
	n = int(n)
	k = 2
	while 2 ** k - 1 <= n:
		b = 2 ** k - 1
		if n % b == 0:
			a = n / b
			break
		k = k + 1
	print(int(a))
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	s = 3
	k = 2
	while k < 30 and n % s != 0:
		s = s + 2 ** k
		k = k + 1
	print(int(n / s))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
t = int(input())
for _ in range(t):
	n = int(input())
	ans = -1
	for i in range(2, 100):
		if n % (2 ** i - 1) == 0:
			ans = n // (2 ** i - 1)
			break
	print(ans)


from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def main():
	for _ in range(ii()):
		n = ii()
		k = 3
		s = 2
		while 1:
			if n % k == 0:
				print(n // k)
				break
			s *= 2
			k += s
main()


for i in range(int(input())):
	a = int(input())
	for k in range(1, 100000):
		if a % (2 ** k - 1) == 0 and k > 1:
			print(a // (2 ** k - 1))
			break


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	num = 2
	s = 3
	while s <= n:
		if n % s == 0:
			x = n // s
			break
		num *= 2
		s += num
	print(x)


t = int(input())
for _ in range(t):
	k = 2
	n = int(input())
	s = 3
	while n % s != 0 and s <= n:
		s += 2 ** k
		k += 1
	print(n // s)


from sys import stdin, stdout

def f(n):
	c = 2
	r = n
	while r % (2 ** c - 1) != 0:
		c += 1
	x = 2 ** c - 1
	print(int(n / x))
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	f(n)


import sys
input = sys.stdin.readline
A = []
for i in range(2, 34):
	A.append((1 << i) - 1)
for test in range(int(input())):
	n = int(input())
	for a in A:
		if n % a == 0:
			print(n // a)
			break


n = int(input())
for peradaban in range(n):
	a = int(input())
	c = 4
	while a % (c - 1) != 0:
		c *= 2
	print(a // (c - 1))


for i in range(int(input())):
	n = int(input())
	i = 2
	c = 3
	while n % c != 0:
		i *= 2
		c += i
	print(n // c)


w = int(input())
m = []
for i in range(w):
	m.append(int(input()))
for i in range(w):
	y = 0
	k = 3
	c = 2
	n = []
	while m[i] >= k:
		y = m[i] / k
		if m[i] % k == 0:
			n.append(y)
		k += 2 ** c
		c += 1
	print(int(n[0]))


pw = {}
i = 0
while pow(2, i) < pow(10, 9) + 2:
	pw[pow(2, i) - 1] = True
	i += 1
import math
tc = int(input())
while tc > 0:
	tc -= 1
	n = int(input())
	try:
		if pw[n]:
			print(1)
	except:
		k = 2
		while n % (pow(2, k) - 1) != 0:
			k += 1
		print(int(n / (pow(2, k) - 1)))


import sys
from math import floor

def input():
	a = sys.stdin.readline()
	if a[-1] == '\n':
		a = a[:-1]
	return a

def print(*argv):
	n = len(argv)
	for i in range(n):
		if i == n - 1:
			sys.stdout.write(str(argv[i]) + '\n')
		else:
			sys.stdout.write(str(argv[i]) + ' ')

def lcm(x, y):
	from math import gcd
	return x * y / gcd(x, y)

def solve(n):
	(val, ind) = (1, 1)
	while val <= n:
		val += 2 ** ind
		if n % val == 0:
			return n // val
		ind += 1
	return 1
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


T = int(input())
for t in range(T):
	N = int(input())
	k = 2
	while True:
		if N % (2 ** k - 1) == 0:
			print(int(N / (2 ** k - 1)))
			break
		k += 1


t = int(input())
delit = 3
Flag = False
for i in range(t):
	n = int(input())
	while Flag == False:
		if n % delit == 0:
			x = int(n / delit)
			Flag = True
			delit = 3
		else:
			delit = delit * 2 + 1
	print(x)
	Flag = False


q = int(input())
for i in range(q):
	n = int(input())
	for k in range(2, n):
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		elif n <= 2 ** k - 1:
			break


for test_i in range(int(input())):
	n = int(input())
	if n == 3:
		print(1)
	else:
		div = 3
		while div <= n // 2:
			if n % div == 0:
				print(n // div)
				break
			else:
				div = div * 2 + 1
		if n == div:
			print(1)


trials = int(input())
answers = []

def func(n):
	l = [1, 2]
	while True:
		if n % (l[-1] * 2 - 1) == 0:
			return n / (l[-1] * 2 - 1)
		else:
			l.append(l[-1] * 2)
while trials != 0:
	trials -= 1
	n = int(input())
	x = func(n)
	answers.append(x)
for i in answers:
	print(int(i))


import io
import os
from collections import Counter, defaultdict, deque

def solve(N):
	temp = 3
	while N % temp != 0:
		temp = 2 * temp + 1
	return N // temp
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


t = int(input())
kase = 0

def fpow(a, b):
	res = 1
	while b:
		if b & 1:
			res *= a
		a *= a
		b = b >> 1
	return res
while kase < t:
	kase += 1
	n = int(input())
	k = 1
	while True:
		k += 1
		if n % (fpow(2, k) - 1) == 0:
			print(n // (fpow(2, k) - 1))
			break


from sys import stdin
import math
a = int(stdin.readline())
for k in range(0, a):
	b = int(stdin.readline())
	l = 2
	while True:
		if b % (2 ** l - 1) != 0:
			l += 1
		else:
			print(int(b / (2 ** l - 1)))
			break


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	d = 4
	while n % (d - 1) != 0:
		d *= 2
	ans.append(n // (d - 1))
for i in ans:
	print(i)


n = int(input())
for i in range(n):
	a = int(input())
	m = 2
	h = 1
	while h:
		if a % (pow(2, m) - 1) == 0:
			h = 0
			ans = a // (pow(2, m) - 1)
		m = m + 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	k = 4
	p = 3
	while n % p != 0:
		p = p + k
		k = k * 2
	print(n // p)


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(1, 100):
		sum = (2 << k) - 1
		if n % sum == 0:
			print(n // sum)
			break


t = int(input())
for i in range(t):
	n = int(input())
	for k in range(2, 37):
		d = pow(2, k) - 1
		if n % d == 0:
			print(n // d)
			break


n1 = int(input())
for i in range(n1):
	n = int(input())
	s = 0
	i = 2
	while s != n:
		s1 = pow(2, i) - 1
		x = int(n / s1)
		if x * s1 == n:
			s = n
		else:
			i += 1
	print(x)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))
t = inp()

def solve():
	n = inp()
	for k in range(2, n):
		if n / (2 ** k - 1) == n // (2 ** k - 1):
			print(n // (2 ** k - 1))
			return
for i in range(t):
	solve()


for i in range(0, int(input())):
	n = int(input())
	res = 0
	k = 1
	while res != n:
		res = res + k
		k = k * 2
		if res != 1 and n % res == 0:
			break
	print(n // res)


list = []
n = input()
n = int(n)
for k in range(n):
	new = input()
	new = int(new)
	list.append(new)
for j in range(n):
	for i in range(2, list[j]):
		if 2 ** i - 1 > list[j]:
			break
		if list[j] % (2 ** i - 1) == 0:
			print(int(list[j] / (2 ** i - 1)))
			break


t = int(input())
for i in range(t):
	n = int(input())
	c = 1
	k = 2
	while c != 0:
		temp = pow(2, k) - 1
		if n % temp == 0:
			print(int(n / temp))
			c = 0
		k = k + 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	r = 1
	for i in range(2, 30):
		r = 1 << i
		r -= 1
		if n / r == int(n // r):
			print(n // r)
			break


testCount = int(input())
for _ in range(testCount):
	n = int(input())
	currentK = 2
	currentSum = 2 ** currentK - 1
	while currentSum <= n:
		if n % currentSum == 0:
			print(n // currentSum)
			break
		currentK += 1
		currentSum = 2 ** currentK - 1


import math
import sys
from collections import defaultdict
from collections import Counter
from collections import deque
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
for _ in range(int(input())):
	N = int(input())
	k = 1
	while True:
		k += 1
		c = 2 ** k - 1
		if N % c == 0:
			z = N // c
			print(z)
			break


n = int(input())
res = []
for i in range(n):
	n = int(input())
	for k in range(2, 33):
		r = n / (2 ** k - 1)
		if r.is_integer():
			res.append(r)
			break
for i in res:
	print(int(i))


import sys
import math
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	pow2 = 4
	while 1 > 0:
		if n % (pow2 - 1) == 0:
			print(n // (pow2 - 1))
			break
		else:
			pow2 *= 2


x = int(input())
l = []
for i in range(x):
	n = int(input())
	p = True
	k = 2
	while p:
		j = n / (2 ** k - 1)
		if j - int(j) == 0.0:
			l.append(int(j))
			p = False
		k += 1
for i in l:
	print(i)


from sys import stdin
input = stdin.readline
p = [2 ** x - 1 for x in range(2, 30)]
for ti in range(int(input().strip())):
	n = int(input().strip())
	for pi in p:
		if n % pi == 0:
			print(n // pi)
			break


t = int(input())
for pp in range(0, t):
	n = int(input())
	for i in range(2, 1000000000):
		dev = 2 ** i - 1
		ck = n / dev
		if ck % 1 == 0:
			print(int(ck))
			break


import math
import os
import random
import re
import sys

def find_x(n):
	power = 2
	for k in range(2, n):
		power *= 2
		if n % (power - 1) == 0:
			return n / (power - 1)
num_test = int(input())
for i in range(num_test):
	n = int(input())
	print(int(find_x(n)))


def solve():
	n = int(input())
	acc = 3
	i = 1
	while n % acc != 0:
		i += 1
		acc += 2 ** i
	print(n // acc)
t = int(input())
for i in range(t):
	solve()


def solve(n):
	cur = 2
	s = 1
	while s <= n:
		s += cur
		if n % s == 0:
			return n // s
		cur = cur * 2
	return -1
t = int(input())
for i in range(0, t):
	n = int(input())
	res = solve(n)
	print(res)


t = int(input())
a = []
k = 4
s = 3
while s < 1000000000:
	a.append(s)
	s += k
	k *= 2
for _ in range(t):
	n = int(input())
	for i in a:
		if n % i == 0:
			print(n // i)
			break


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
l = []
p = 2
for i in range(50):
	p *= 2
	l.append(p - 1)
for _ in range(t):
	n = int(input())
	for li in l:
		if n % li == 0:
			print(n // li)
			break


for f in range(int(input())):
	n = int(input())
	d = 4
	fo = 0
	while fo == 0:
		if n % (d - 1) == 0:
			print(n // (d - 1))
			fo = 1
		d *= 2


for xx in range(int(input())):
	n = int(input())
	sm = 1
	i = 1
	while 1:
		k = 2 ** i
		sm += k
		if n % sm == 0:
			print(int(n / sm))
			break
		i += 1


t = int(input())
for i in range(t):
	n = int(input())
	j = 2
	while 1:
		div = int(pow(2, j)) - 1
		if n % div == 0:
			print(n // div)
			break
		else:
			j += 1


for _ in range(int(input())):
	n = int(input())
	coefficient = 2
	now = 3
	while True:
		if n % now == 0:
			print(n // now)
			break
		coefficient *= 2
		now += coefficient


t = int(input())
valores = []
for i in range(t):
	valores.append(int(input()))
for i in valores:
	n = i
	j = [1]
	while j[-1] <= n:
		j.append(2 * j[-1])
	j.remove(1)
	j.remove(2)
	for w in j:
		if n % (w - 1) == 0:
			x = int(n / (w - 1))
			break
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	li = []
	for i in range(2, 36):
		li.append(2 ** i - 1)
	for i in li:
		if n % i == 0:
			print(n // i)
			break


for _ in range(int(input())):
	n = int(input())
	m = 2
	while True:
		if n % (2 ** m - 1) == 0:
			print(n // (2 ** m - 1))
			break
		m += 1


powArr = [2 ** x - 1 for x in range(2, 31, 1)]
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	for a in powArr:
		if n % a == 0:
			print(n // a)
			break


nt = int(input())
for z in range(nt):
	n = int(input())
	k = 2
	while True:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		else:
			k += 1
pass


import math as m
for t in range(int(input())):
	n = int(input())
	k = 2
	while True:
		x = n / (2 ** k - 1)
		if int(x) == m.ceil(x):
			print(int(x))
			break
		k = k + 1


import math
a = int(input())
for i in range(a):
	n = int(input())
	for j in range(2, 30):
		if n % (math.pow(2, j) - 1) == 0:
			print(math.trunc(n / (math.pow(2, j) - 1)))
			break


T = int(input())
for i in range(T):
	n = int(input())
	i = 2
	while True:
		if n % (pow(2, i) - 1) == 0:
			print(int(n / (pow(2, i) - 1)))
			break
		else:
			i += 1


from collections import *
from sys import *
inp = stdin.readline
flag = 1
if not flag:
	out = stdout.write
	str = str
else:
	out = print

def linp(x):
	return list(map(int, x.split()))

def minp(x):
	return map(int, x.split())
t = int(inp())
while t > 0:
	n = int(inp())
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(int(n / (2 ** k - 1)))
	t -= 1


T = int(input())
for i in range(T):
	n = int(input())
	sum = 3
	j = 2
	while n % sum != 0:
		res = 2 ** j
		j += 1
		sum = sum + res
	print(int(n / sum))


a = int(input())
for i in range(a):
	b = int(input())
	i = 3
	q = 2
	while b % i != 0:
		q = q * 2
		i = i + q
	else:
		print(b // i)


def problem1():
	a = int(input())
	k = 4
	while a % (k - 1) != 0:
		k *= 2
	print(a // (k - 1))

def problem2():
	a = int(input())
	if a % 4 == 2:
		print('NO')
		return
	print('YES')
	x = []
	for i in range(1, a // 2 + 1):
		x.append(2 * i)
	for i in range(a // 4):
		x.append(x[i] - 1)
	for i in range(a // 4, a // 2):
		x.append(x[i] + 1)
	print(*x)

def problem3():
	l = int(input())
	a = list(map(int, input().split()))
	k = -1 * min(a)
	i = 0
	s = 0
	while i < l:
		mp = 0
		mn = k + 1
		while i < l and a[i] > 0:
			mp = max(a[i], mp)
			i += 1
		while i < l and a[i] < 0:
			mn = min(abs(a[i]), mn)
			i += 1
		s += mp
		if mn != k + 1:
			s -= mn
	print(s)

def problem4():
	(l, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	s = []
	t = []
	u = []
	for i in range(l // 2):
		s.append(a[i] + a[l - i - 1])
		t.append(min(1 + a[i], 1 + a[l - i - 1]))
		u.append(max(k + a[i], k + a[l - i - 1]))
	v = list(set([(s.count(i), i) for i in s]))
cases = int(input())
for _ in range(cases):
	problem1()


def candies_alt(n):
	for i in range(2, 30):
		ans = 2 ** i - 1
		if n % ans == 0:
			print(n // ans)
			return
t = int(input())
for i in range(t):
	n = int(input())
	candies_alt(n)


from sys import stdin
t = int(stdin.readline())
for _ in range(0, t):
	n = int(stdin.readline())
	hasFoundK = False
	k = 1
	while not hasFoundK:
		k += 1
		if n % (2 ** k - 1) == 0:
			hasFoundK = True
	x = n // (2 ** k - 1)
	print(x)


import sys
k = 31 * [0]
k[0] = 1
for i in range(1, 31):
	k[i] = k[i - 1] * 2
for i in range(2, 31):
	k[i] -= 1
t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, 31):
		if n % k[i] == 0:
			print(int(n / k[i]))
			break


from math import *
test = int(input())
for test_case in range(test):
	n = int(input())
	ct = 3
	p = 2
	while 1:
		if n % ct == 0:
			print(n // ct)
			break
		p *= 2
		ct += p


import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		for k in range(2, int(math.log(n, 2)) + 2):
			if n % (2 ** k - 1) == 0:
				x = n // (2 ** k - 1)
				print(x)
				break
main()


T = int(input())
for j in range(0, T):
	N = int(input())
	A = []
	for i in range(2, 30):
		A.append(int(pow(2, i)) - 1)
	l = len(A)
	for i in range(0, l):
		if N % A[i] == 0:
			ans = int(N / A[i])
			break
	print(ans)


import math

def ans(wrap):
	k = 2
	while True:
		x = wrap / (2 ** k - 1)
		if x % 1 == 0:
			return int(x)
		k += 1
t = int(input())
for i in range(t):
	n = int(input())
	print(ans(n))


import math
m = 10 ** 9 + 7
for i in range(int(input())):
	n = int(input())
	i = 2
	while 1:
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break
		else:
			i += 1


t = int(input())
listA = []
flag = 1
for i in range(0, t):
	n = int(input())
	listA.append(n)
i = 0
while 1:
	if flag == 1:
		j = 1
		value = 1
	value = value + pow(2, j)
	if listA[i] % value == 0:
		ans = int(listA[i] / value)
		print(ans)
		flag = 1
		i += 1
		if i == t:
			break
		continue
	else:
		j += 1
		flag = 0


import math
T = int(input())
while T > 0:
	n = int(input())
	k = 2
	while n % (math.pow(2, k) - 1):
		k += 1
	print(int(n / (math.pow(2, k) - 1)))
	T -= 1


T = int(input())
for _ in range(T):
	n = int(input())
	k = 2
	while True:
		x = n / (2 ** k - 1)
		if int(x) == x:
			print(int(x))
			break
		k += 1


te = int(input())
for i in range(te):
	s = int(input())
	n = 2
	while True:
		if s % (2 ** n - 1) == 0:
			break
		n += 1
	print(s // (2 ** n - 1))


t = int(input())
for z in range(t):
	n = int(input())
	i = 2
	while True:
		x = n / (2 ** i - 1)
		l = int(x)
		i += 1
		if x == l:
			print(l)
			break


def solution(n):
	Set = set()
	i = 4
	while i <= 10 ** 9:
		Set.add(i - 1)
		i *= 2
	for e in Set:
		if n % e == 0:
			return n // e
for _ in range(int(input())):
	print(solution(int(input())))


t = int(input())
n = [int(input()) for _ in range(t)]
coef = [1]
k = 1
while coef[-1] < max(n):
	coef.extend([coef[-1] + 2 ** k])
	k += 1
coef.pop(0)
for ni in n:
	x = 1
	for c in coef:
		if x * c > ni:
			break
		if ni % c == 0:
			x = int(ni / c)
	print(x)


dvas = [2 ** i - 1 for i in range(2, 30)]

def checker(n):
	for item in dvas:
		if n % item == 0:
			return int(n / item)
t = int(input())
answers = []
for i in range(t):
	n = int(input())
	answers.append(checker(n))
for answer in answers:
	print(answer)


t = int(input())
while t:
	n = int(input())
	i = 2
	while True:
		two = pow(2, i)
		two -= 1
		if n % two == 0:
			print(n // two)
			break
		i += 1
	t -= 1


for i in range(int(input())):
	n = int(input())
	ch = 3
	num = 2
	while n % ch != 0:
		num *= 2
		ch += num
	print(n // ch)


import sys
import math
from collections import deque
import random

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
t = read_int()
for i in range(t):
	n = read_int()
	k = 2
	x = -1
	while 2 ** k - 1 <= n:
		if n % (2 ** k - 1) == 0:
			x = n // (2 ** k - 1)
			break
		else:
			k += 1
	print(x)


T = int(input())
for test in range(T):
	n = int(input())
	k = 2
	x = n // (2 ** k - 1)
	while True:
		if n % (2 ** k - 1) == 0:
			print(n // (2 ** k - 1))
			break
		k += 1


t = int(input())
for _ in range(t):
	n = int(input())
	st = 4
	while n % (st - 1) != 0:
		st *= 2
	print(n // (st - 1))


for _ in [0] * int(input()):
	n = int(input())
	k = [x for x in range(1, 31) if n % ((2 << x) - 1) < 1][0]
	print(n // ((2 << k) - 1))


import sys
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	t = inin()
	while t > 0:
		n = inin()
		k = 2
		for i in range(2, n + 1):
			x = n / (pow(2, i) - 1)
			if float(x).is_integer():
				print(int(x))
				break
		t = t - 1
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def get_answer(n):
	k = 2
	while 2 ** k - 1 <= n:
		if n % (2 ** k - 1) == 0:
			return n // (2 ** k - 1)
		k += 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(get_answer(n))


cases = int(input())
while cases:
	cases -= 1
	num = int(input())
	i = 1
	value = 1
	while True:
		value += 2 ** i
		i += 1
		if num % value == 0:
			print(num // value)
			break


t = int(input())
while t:
	z = int(input())
	n = 2
	while True:
		c = 2 ** n - 1
		if z % c == 0:
			print(z // c)
			break
		n = n + 1
	t = t - 1


t = int(input())

def is_power(n):
	if n < 4:
		return False
	while n % 2 == 0:
		n //= 2
	return n == 1
ans = []
for i in range(t):
	n = int(input())
	h = 3
	while h <= n:
		if n % h == 0:
			ans.append(n // h)
			break
		h = h * 2 + 1
for el in ans:
	print(el)


tests = int(input())
res = []
for i in range(tests):
	n = int(input())
	i = 2
	while True:
		if n % (2 ** i - 1) == 0:
			res.append(n // (2 ** i - 1))
			break
		else:
			i += 1
for result in res:
	print(result)


n = int(input())
for j in range(n):
	a = int(input())
	Sum = 1
	for i in range(1, 100000001):
		Sum = Sum + 2 ** i
		if a % Sum == 0:
			b = a // Sum
			break
	print(b)


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	while 1:
		x = n / (2 ** i - 1)
		if x.is_integer():
			print(int(x))
			break
		else:
			i += 1


from sys import setrecursionlimit
from collections import deque
import heapq
import functools
setrecursionlimit(10 ** 6)

def IntInput():
	return int(input())

def M_IntInput():
	return map(int, input().split())

def M_StrInput():
	return map(int, input().split())

def IntArrayInput():
	return list(map(int, input().split()))

def modInverse(p, a, m):
	return p % m * pow(a % m, m - 2, m) % m

def compare(item1, item2):
	return item2[0] - item1[0] if item1[0] != item2[0] else item1[1] - item2[1]

def DFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	stack = []
	stack.append(s)
	visited[s] = True
	DFSArray = []
	while stack:
		s = stack.pop()
		DFSArray.append(s)
		flag = 0
		for i in paths[s]:
			if visited[i] == False:
				flag = 1
				stack.append(i)
				visited[i] = True
		if not flag:
			answer[s - 1][1] = 0
	while DFSArray != []:
		s = DFSArray.pop()
		if answer[s - 1][1] < 0:
			answer[s - 1][1] = 0
			for i in paths[s]:
				if answer[i - 1][1] >= 0:
					answer[s - 1][1] += answer[i - 1][1] + 1
	return answer

def BFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	answer[s - 1][0] = 0
	queue = deque()
	queue.append(s)
	visited[s] = True
	while queue:
		s = deque.popleft(queue)
		for i in paths[s]:
			if visited[i] == False:
				queue.append(i)
				answer[i - 1][0] = answer[s - 1][0] + 1
				visited[i] = True
	return answer
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for _ in range(int(input())):
	n = int(input())
	sumV = 1
	last = 1
	for i in range(1, n):
		last *= 2
		sumV += last
		if n % sumV == 0:
			break
	print(n // sumV)


t = int(input())
two_pows = [4]
lim = 10 ** 9
while two_pows[-1] < lim:
	two_pows.append(two_pows[-1] * 2)
del two_pows[-1]
for i in range(t):
	n = int(input())
	for p in two_pows:
		x = n / (p - 1)
		if x == int(x):
			print(int(x))
			break


for _ in range(int(input())):
	n = int(input())
	if n == 3:
		print(1)
	else:
		for i in range(2, n // 2 + 1):
			if n % (pow(2, i) - 1) == 0:
				print(n // (pow(2, i) - 1))
				break


import sys
input = sys.stdin.readline

def ini():
	return int(input())

def inil():
	return list(map(int, input().split()))

def insl():
	s = input()
	return list(s[:len(s) - 1])
t = ini()
for _ in range(t):
	n = ini()
	k = 2
	while n % (2 ** k - 1) != 0:
		k += 1
	print(n // (2 ** k - 1))


tc = int(input())
for _ in range(tc):
	n = int(input())
	for k in range(2, 1000):
		if n % (2 ** k - 1) == 0:
			x = n / (2 ** k - 1)
			break
	print(int(x))


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	for k in range(2, 30):
		x = n / (2 ** k - 1)
		if x == math.ceil(x):
			print(int(x))
			break


t = int(input())
for q in range(t):
	n = int(input())
	div = 2
	a = 0
	while div < n * 2:
		if n % (div - 1) == 0 and div > 2:
			a = n / (div - 1)
			break
		div *= 2
	print(int(a))


t = int(input())
arr = []
for k in range(2, 30):
	arr.append(pow(2, k) - 1)
for i in range(t):
	n = int(input())
	for el in arr:
		if n % el == 0:
			print(n // el)
			break


import math
for _ in range(int(input())):
	n = int(input())
	s = 3
	k = 2
	while True:
		if n % s == 0:
			print(n // s)
			break
		s += 2 ** k
		k += 1


for T in range(int(input())):
	a = int(input())
	div = 1
	for i in range(1, a):
		div += 2 ** i
		if a % div == 0:
			print(int(a / div))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, 33):
		div = (1 << i) - 1
		if n % div == 0:
			print(n // div)
			break


t = int(input())
for j in range(t):
	n = int(input())
	c = 3
	k = 2
	tr = True
	while tr:
		if n % c == 0:
			print(n // c)
			tr = False
		else:
			c += 2 ** k
			k += 1


n = int(input())

def checker(x):
	summ = 1
	for i in range(2, 100):
		summ += 2 ** (i - 1)
		if x % summ == 0:
			break
	return int(x / summ)
for i in range(n):
	print(checker(int(input())))


sumaPow2 = lambda x: 2 ** x - 1
for _ in range(int(input())):
	test = int(input())
	k = 2
	while test % sumaPow2(k) != 0:
		k += 1
	print(test // sumaPow2(k))


maxn = 30
l = [1]
for i in range(30):
	l += [l[-1] * 2]
l.pop(0)
l.pop(0)
for _ in range(int(input())):
	n = int(input())
	for i in l:
		if n % (i - 1) == 0:
			print(n // (i - 1))
			break


t = int(input())
for _ in range(t):
	n = int(input())
	for k in range(2, 30):
		a = n // (2 ** k - 1)
		b = n / (2 ** k - 1)
		if a == b:
			break
	print(a)


n = int(input())
for i in range(n):
	n1 = int(input())
	n2 = n1
	while n2 % 2 == 0:
		n2 = n2 / 2
	f = 0
	i = 2
	while True:
		if 2 ** i - 1 > n2:
			break
		if n2 % (2 ** i - 1) == 0:
			f = 2 ** i - 1
			break
		i += 1
	print(n1 // f)


pows = [2 ** item - 1 for item in range(2, 31)]
for item in range(int(input())):
	number = int(input())
	for iterator in pows:
		if number % iterator == 0:
			print(number // iterator)
			break


import math
from sys import stdin
input = stdin.readline
for i in range(int(input())):
	n = int(input())
	k = 2
	while 1:
		if n % (pow(2, k) - 1) == 0:
			print(int(n / (pow(2, k) - 1)))
			break
		k += 1


import sys
input = lambda : sys.stdin.readline().strip()
li = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	for i in range(2, 31):
		if n % (2 ** i - 1) == 0:
			print(n // (2 ** i - 1))
			break


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	a = 3
	b = 4
	while 1:
		if N % a == 0:
			print(N // a)
			break
		a += b
		b *= 2


import math
t = int(input())
for val in range(t):
	n = int(input())
	(k, d) = (3, 2)
	while n % k != 0:
		k = k + 2 ** d
		d += 1
	print(int(n / k))


from sys import stdin, stdout

class Solve:

	def __init__(self):
		r = stdin.readline
		w = stdout.write
		ans = []
		for _ in range(int(input())):
			n = int(r())
			(two, power) = (3, 2)
			while n % two:
				two += 2 ** power
				power += 1
			ans.append(str(n // two))
		w('\n'.join(ans))

def main():
	s = Solve()
main()


from math import ceil
T = int(input())
results = []
for case in range(1, T + 1):
	n = int(input())
	power = 1
	su = 3
	while n / su % 1 != 0:
		power += 1
		su += 2 ** power
	result = n // su
	results.append(result)
for result in results:
	print(result)


t = int(input())
for ts in range(t):
	i = 4
	a = int(input())
	while i - 1 <= a:
		if a % (i - 1) == 0:
			print(a // (i - 1))
			break
		i *= 2
	else:
		print(a)


import math
for _ in range(int(input())):
	s = int(input())
	x = 0
	k = int(math.log(s, 2))
	for i in range(2, k + 32):
		if s % (2 ** i - 1) == 0:
			x = s // (2 ** i - 1)
			break
	print(x)


p = []
i = 4
while i < 10 ** 9:
	p += [i - 1]
	i *= 2
from math import log2, ceil, floor
for _ in range(int(input())):
	n = int(input())
	for i in p:
		if n % i == 0:
			print(n // i)
			break


for _ in range(int(input())):
	n = int(input())
	k = 2
	while 1:
		if n / (2 ** k - 1) == int(n / (2 ** k - 1)):
			print(int(n / (2 ** k - 1)))
			break
		else:
			k = k + 1


import math
for t in range(int(input())):
	num = int(input())
	k = 2
	while True:
		x = num / (pow(2, k) - 1)
		if math.floor(x) == math.ceil(x):
			break
		k += 1
	print(int(x))


import math
t = int(input())
for test in range(t):
	n = int(input())
	lg = math.ceil(math.log2(3))
	num = pow(2, lg) - 1
	Found = False
	i = 3
	while num <= n and Found == False:
		if n % num == 0:
			print(n // num)
			break
		num = (num + 1) * 2 - 1


for _ in range(int(input())):
	n = int(input())
	key = 2
	answer = 0
	while True:
		if n % (2 ** key - 1) == 0:
			break
		key += 1
	answer = n // (2 ** key - 1)
	print(answer)


for _ in range(int(input())):
	n = int(input())
	for k in range(1, 100000):
		p = n / (2 ** (k + 1) - 1)
		if int(p) == p:
			break
	print(int(p))


import math
t = int(input())
for i in range(t):
	n = int(input())
	length = int(math.log2(n + 1))
	for k in range(2, length + 1):
		x = 2 ** k - 1
		if n % x == 0:
			print(n // x)
			break


for _ in range(int(input())):
	n = int(input())
	d = 3
	for i in range(1000000000):
		if n % d == 0:
			print(n // d)
			break
		d += 2 ** (i + 2)


def Sol(n):
	k = 2
	d = 2 ** k - 1
	while n % d != 0:
		k += 1
		d = 2 ** k - 1
	print(int(n / d))
	return
for t in range(int(input())):
	Sol(int(input()))


t = int(input())
for i in range(0, t):
	n = int(input())
	k = 2
	while k > 1:
		y = 2 ** k - 1
		r = n % y
		if r == 0:
			break
		k = k + 1
	q = n // y
	print(q)


n = int(input())
for i in range(n):
	m = int(input())
	a = 1
	for k in range(1, 31):
		a += 2 ** k
		if m % a == 0:
			print(m // a)
			break


import sys
input = sys.stdin.readline
Q = int(input())
Query = [int(input()) for _ in range(Q)]
for N in Query:
	t = 4
	while True:
		if N % (t - 1) == 0:
			break
		t *= 2
	print(N // (t - 1))


for _ in range(int(input())):
	n = int(input())
	for i in range(2, 10000):
		val = pow(2, i) - 1
		if n % val == 0:
			print(n // val)
			break


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	po2 = 4
	i = 1
	while 1:
		if n % (po2 - 1) == 0:
			print(n // (po2 - 1))
			break
		else:
			po2 *= 2
		i += 1


from sys import stdin, stdout
d = {}
c = 1
s = 0
for i in range(1, 10000):
	d[i] = c + s
	s += c
	c = c * 2
for _ in range(int(stdin.readline().strip())):
	n = int(stdin.readline().strip())
	for i in range(2, n):
		if n % d[i] == 0:
			stdout.write(str(int(n / d[i])) + '\n')
			break


t = int(input())
for z in range(t):
	n = int(input())
	ans = 0
	for i in range(2, 1000):
		f = n / ((1 << i) - 1)
		if f == int(f):
			ans = int(f)
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2
	val = 1 + 2
	found = False
	x = None
	while not found:
		if n % val == 0:
			x = n // val
			found = True
		else:
			val += 2 ** k
			k += 1
	print(x)


t = int(input())
count = 0
ans = []
while count < t:
	n = int(input())
	base = 3
	added = 2
	while n % base != 0:
		added *= 2
		base += added
	ans.append(n // base)
	count += 1
for y in ans:
	print(y)


for x in range(int(input())):
	y = int(input())
	n = 2
	if y != 3:
		while n > 0:
			if y % (pow(2, n) - 1) == 0:
				break
			else:
				n += 1
		print(y // (pow(2, n) - 1))
	else:
		print('1')


import sys
import math
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	for k in range(2, 40):
		tmp = 2 ** k - 1
		if n % tmp == 0:
			print(n // tmp)
			break


t = int(input())
for _ in range(t):
	n = int(input())
	divisor = 3
	if n % 2 == 0:
		start = 2
	else:
		start = 3
	for i in range(start, n + 1, 2):
		if n % divisor == 0:
			print(n // divisor)
			break
		divisor = divisor * 2 + 1


T = int(input())
i = 0
while i < T:
	n = int(input())
	k = 2
	while not n % (2 ** k - 1) == 0:
		k += 1
	print(n // (2 ** k - 1))
	i += 1


import sys
import math
inputs = []
for line in sys.stdin:
	inputs.append(int(line.split('\n')[0].strip()))
for i in range(inputs[0]):
	for k in range(2, 31):
		two_pow = 2 ** k - 1
		if math.ceil(inputs[i + 1] / two_pow) == inputs[i + 1] // two_pow:
			print(inputs[i + 1] // two_pow)
			break


import math

def fun(x):
	global data
	for q in data:
		if x % q == 0:
			return x // q
for _ in range(int(input())):
	data = [2 ** x - 1 for x in range(2, 50)]
	n = int(input())
	print(fun(n))


import math
t = int(input())
while t > 0:
	n = int(input())
	i = 2
	while True:
		if n % (math.pow(2, i) - 1) == 0:
			print(int(n / (math.pow(2, i) - 1)))
			break
		else:
			i += 1
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	p = []
	for j in range(2, 32):
		p.append(2 ** j - 1)
	for j in p:
		if n % j == 0:
			print(n // j)
			break


import sys
input = sys.stdin.readline
inputLines = sys.stdin.readlines

def readIntList():
	return list(map(int, input().split()))

def readStrList():
	return list(map(lambda x: x.strip(), inputLines()))

def indexOf(l: list, elem):
	return l.index(elem) if elem in l else -1

def lastIndexOf(l: list, elem):
	indexes = [idx for (idx, val) in enumerate(l) if val == elem]
	return max(indexes) if len(indexes) > 0 else -1

def distinct(l: list):
	used = set()
	return [x for x in l if x not in used and (used.add(x) or True)]

def solution():
	for _ in range(int(input())):
		n = int(input())
		m = 3
		z = 4
		while True:
			if n % m == 0:
				print(int(n / m))
				break
			m += z
			z *= 2
solution()


def logic(r):
	for i in range(2, 30):
		z = r % (2 ** i - 1)
		if z == 0:
			return r / (2 ** i - 1)
arr = []
n = int(input())
for i in range(n):
	temp = int(input())
	arr.append(temp)
for i in range(n):
	temp = logic(arr[i])
	print(int(temp))