# include <cstdio>
using namespace std;
inline int gcd(int a, int b){ int t; while (b){ a = a%b; t = a; a = b; b = t; }return a; }
struct node
{
int l, r;
int val;
int fr;
};
node nodes[31*100000];
int lastn = 2;
void update(int& cur, int l, int r, int x, int y)
{
if (cur == 0)
cur = lastn++;
if (l == r)
{
nodes[cur].fr += y;
if (nodes[cur].fr == 0)
{
nodes[cur].val = 0;
}
else
{
nodes[cur].val = x;
}
}
else
{
int m = (l + r) >> 1;
if (x <= m)
{
update(nodes[cur].l, l, m, x, y);
}
else
{
update(nodes[cur].r, m + 1, r, x, y);
}
nodes[cur].val = gcd(nodes[nodes[cur].l].val, nodes[nodes[cur].r].val);
}
}
int main()
{
int n;
scanf("%d", &n);
int res = 0;
int root = 1;
while (n--)
{
char c;
int x;
scanf("\n%c %d", &c, &x);
if (c == '+')
{
update(root, 1, 1000000000, x, 1);
}
else
{
update(root, 1, 1000000000, x, -1);
}
res = nodes[1].val;
if (res == 0)
res = 1;
printf("%d\n", res);
}
return 0;
}
IyBpbmNsdWRlIDxjc3RkaW8+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbmxpbmUgaW50IGdjZChpbnQgYSwgaW50IGIpeyBpbnQgdDsgd2hpbGUgKGIpeyBhID0gYSViOyB0ID0gYTsgYSA9IGI7IGIgPSB0OyB9cmV0dXJuIGE7IH0KCnN0cnVjdCBub2RlCnsKCWludCBsLCByOwoJaW50IHZhbDsKCWludCBmcjsKfTsgCm5vZGUgbm9kZXNbMzEqMTAwMDAwXTsKaW50IGxhc3RuID0gMjsKdm9pZCB1cGRhdGUoaW50JiBjdXIsIGludCBsLCBpbnQgciwgaW50IHgsIGludCB5KQp7CglpZiAoY3VyID09IDApCgkJY3VyID0gbGFzdG4rKzsKCglpZiAobCA9PSByKQoJewoJCW5vZGVzW2N1cl0uZnIgKz0geTsKCQlpZiAobm9kZXNbY3VyXS5mciA9PSAwKQoJCXsKCQkJbm9kZXNbY3VyXS52YWwgPSAwOwoJCX0KCQllbHNlC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