#include <iostream>
using namespace std;
const int MAX_SIZE = 50000;
int main() {
int n, arr[MAX_SIZE + 1];
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
}
int m;
cin >> m;
int x;
for (int j = 1; j <= m; ++j) {
cin >> x;
int left = 1, right = n, firstPosition = -1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (arr[mid] == x) {
firstPosition = mid;
right = mid - 1;
} else if (arr[mid] < x) {
left = mid + 1;
} else {
right = mid - 1;
}
}
if (firstPosition != -1) {
cout << x << " se gaseste in sir" << "\n";
} else {
cout << x << " nu se gaseste in sir" << "\n";
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9TSVpFID0gNTAwMDA7CgppbnQgbWFpbigpIHsKICAgIGludCBuLCBhcnJbTUFYX1NJWkUgKyAxXTsKICAgIGNpbiA+PiBuOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgY2luID4+IGFycltpXTsKICAgIH0KICAgIGludCBtOwogICAgY2luID4+IG07CiAgICBpbnQgeDsKICAgIGZvciAoaW50IGogPSAxOyBqIDw9IG07ICsraikgewogICAgICAgIGNpbiA+PiB4OwogICAgICAgIGludCBsZWZ0ID0gMSwgcmlnaHQgPSBuLCBmaXJzdFBvc2l0aW9uID0gLTE7CiAgICAgICAgd2hpbGUgKGxlZnQgPD0gcmlnaHQpIHsKICAgICAgICAgICAgaW50IG1pZCA9IGxlZnQgKyAocmlnaHQgLSBsZWZ0KSAvIDI7CiAgICAgICAgICAgIGlmIChhcnJbbWlkXSA9PSB4KSB7CiAgICAgICAgICAgICAgICBmaXJzdFBvc2l0aW9uID0gbWlkOwogICAgICAgICAgICAgICAgcmlnaHQgPSBtaWQgLSAxOwogICAgICAgICAgICB9IGVsc2UgaWYgKGFyclttaWRdIDwgeCkgewogICAgICAgICAgICAgICAgbGVmdCA9IG1pZCArIDE7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICByaWdodCA9IG1pZCAtIDE7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGZpcnN0UG9zaXRpb24gIT0gLTEpIHsKICAgICAgICAgICAgY291dCA8PCB4IDw8ICIgc2UgZ2FzZXN0ZSBpbiBzaXIiIDw8ICJcbiI7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY291dCA8PCB4IDw8ICIgbnUgc2UgZ2FzZXN0ZSBpbiBzaXIiIDw8ICJcbiI7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDA7Cn0=