#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e7 + 2 ;
vector<ll> divisors(N+1 , 1);
vector<ll>arr(N) ;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tc;
tc = 1;
cin >> tc;
divisors[1] = 1 ;
for (int i = 2; i < N; i++) {
for (int j = i; j < N; j += i) {
divisors[j] += i * 1ll ;
}
}
for(int i = 1 ;i<N; i++){
if(divisors[i] < N && arr[divisors[i]] == 0)
arr[divisors[i]] = i ;
}
while (tc--)
{
int c ;
cin >> c ;
cout<<(arr[c] ? arr[c] : -1)<<endl;
}
}
915A - Garden | 356A - Knight Tournament |
1330A - Dreamoon and Ranking Collection | 1692B - All Distinct |
1156C - Match Points | 1675A - Food for Animals |
1328C - Ternary XOR | 1689A - Lex String |
1708B - Difference of GCDs | 863A - Quasi-palindrome |
1478A - Nezzar and Colorful Balls | 1581B - Diameter of Graph |
404A - Valera and X | 908A - New Year and Counting Cards |
146A - Lucky Ticket | 1594C - Make Them Equal |
1676A - Lucky | 1700B - Palindromic Numbers |
702C - Cellular Network | 1672C - Unequal Array |
1706C - Qpwoeirut And The City | 1697A - Parkway Walk |
1505B - DMCA | 478B - Random Teams |
1705C - Mark and His Unfinished Essay | 1401C - Mere Array |
1613B - Absent Remainder | 1536B - Prinzessin der Verurteilung |
1699B - Almost Ternary Matrix | 1545A - AquaMoon and Strange Sort |