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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include<bits/stdc++.h>   
#include "dzilib.h"   
using namespace std;
typedef long long ll;
const int P = 101;
const ll MLL = 1e18;
const ll LOG = 31;
const int N = 2e6;
int dive[N];
int last[N];
unordered_map<int , int> ump;
map<vector<int> , int> mp;

void siv() {
	last[1] = 1;
	for(int i = 2; i < N; i++) {
		if(last[i] == 0) {
			for(int j = i; j < N; j += i) {
				last[j] = i;
			}
		}
	}
}

void dec(int num) {
	while(num != 1) {
		if(ump.find(last[num]) == ump.end()) ump[num] = 0;
		ump[last[num]]++;
		num /= last[num];
	}
}

void divs() {
	dive[1] = 1;
	for(int i = 2; i <N ; i++) {
		ump.clear();
		dec(i);
		int all = 1;
		for(auto x : ump) {
			all = all * (x.second + 1);
		}
		dive[i] = all;
	}	
}
	
void prec() {
	
	int n = 1e6;
	int len = 10;
	vector<unordered_map<int , int>> leng(len);
	vector<vector<int>> all(n);
	for(int i = 1; i <= n; i++) {
		vector<int> v;
		 for(int j = 0; j < len; j++) {
			 v.push_back(dive[i + j]);
		}
		mp[v] = i;
	} 
	
}

void solve() {
	vector<int> v;
	for(int i = 0; i < 10; i++) {
		int w = Ask(i);
		v.push_back(w);
	}
	int ans = mp[v];
	Answer(ans);
}

int main()
{
	ios_base::sync_with_stdio(false);
	siv();
	divs();
    cin.tie(0);
    prec();
	int t;
	t = GetT();
	int n = GetN();
	int q = GetQ();
	int c = GetC();
	while(t--) {
		solve();
	}

    return 0;
}