#include <bits/stdc++.h>
using namespace std;
int main() {
int E, T;
vector<int> adjList[2500];
cin >> E;
for(int i = 0; i < E; i++) {
//
}
cin >> T;
while(T--) {
int start;
int dist[2500];
for(int i = 0; i < E; i++)
dist[i] = -1;
cin >> start;
queue<int> q;
q.push(start);
dist[start] = 0;
while(!q.empty()) {
int now = q.front(), next; q.pop();
//for() {
q.push(next);
dist[next] = dist[now]+1;
// }
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBFLCBUOwoJdmVjdG9yPGludD4gYWRqTGlzdFsyNTAwXTsKCWNpbiA+PiBFOwoJZm9yKGludCBpID0gMDsgaSA8IEU7IGkrKykgewoJCS8vCgl9CgljaW4gPj4gVDsKCXdoaWxlKFQtLSkgewoJCWludCBzdGFydDsKCQlpbnQgZGlzdFsyNTAwXTsKCQlmb3IoaW50IGkgPSAwOyBpIDwgRTsgaSsrKQoJCQlkaXN0W2ldID0gLTE7CgkJY2luID4+IHN0YXJ0OwoJCXF1ZXVlPGludD4gcTsKCQlxLnB1c2goc3RhcnQpOwoJCWRpc3Rbc3RhcnRdID0gMDsKCQl3aGlsZSghcS5lbXB0eSgpKSB7CgkJCWludCBub3cgPSBxLmZyb250KCksIG5leHQ7IHEucG9wKCk7CgkJCS8vZm9yKCkgewoJCQkJcS5wdXNoKG5leHQpOwoJCQkJZGlzdFtuZXh0XSA9IGRpc3Rbbm93XSsxOwoJCQkvLyB9CgkJfQoJfQoJcmV0dXJuIDA7Cn0=