const LIMIT: usize = 31; fn solve(factors: &Vec>) -> usize { let mut x = String::new(); std::io::stdin().read_line(&mut x).ok(); let x: usize = x.trim().parse().unwrap(); let mut cnts = vec![0usize; LIMIT+1]; let mut ret = LIMIT; let mut target = x; for i in 2..=LIMIT { while target % i == 0 { cnts[i] += 1; target /= i; } } for i in 2..LIMIT { let mut org = 1usize; let mut used = 1usize; for j in 2..=LIMIT { org *= cnts[j] + 1; used *= cnts[j] + 1 + factors[i][j]; } if org * 2 == used { return i * x; } } ret * x } fn main() { let mut t = String::new(); std::io::stdin().read_line(&mut t).ok(); let t: usize = t.trim().parse().unwrap(); let mut result = Vec::with_capacity(t); let mut factors = vec![vec![0usize; LIMIT+1]; LIMIT+1]; for i in 2..=LIMIT { let mut target = i; for j in 2..=LIMIT { while target % j == 0 { target /= j; factors[i][j] += 1; } } } for _ in 0..t { result.push(solve(&factors)); } for &v in result.iter() { println!("{}", v); } }