#include <cstdio>

const int N = 100001;
const int LG = 31;
int q;

int gcd(int a, int b)
{
    int t;
    while (b)
    {
        a = a % b;
        t = a;
        a = b;
        b = t;
    }
    return a;
}

struct Node
{
    int f, g;
    Node *l, *r;

    Node(int f_ = 0, int g_ = 0)
    {
        f = f_;
        g = g_;
        l = r = 0;
    };
};

Node pool[LG * N];
int p = 0;

Node *new_node(int f, int g)
{
    pool[p].f = f;
    pool[p].g = g;
    return &pool[p++];
}

Node *update(Node *t, int i, int v, int l = 1, int r = 1000000000)
{
    if(l == r) {
        if(t == 0) return new_node(1, i);
        else {
            t->f += v;
            if(t->f == 0) return 0;
            return t;
        }
    }

    if(t == 0)
        t = new_node(0, 0);

    int m = (l + r) / 2;
    if(i > m) t->r = update(t->r, i, v, m + 1, r);
    else t->l = update(t->l, i, v, l, m);

    t->g = gcd((t->l?t->l->g:0), (t->r?t->r->g:0));

    return t;
}

int main(int argc, char *argv[])
{
    Node *t = 0;

    scanf("%d", &q);
    for(int i = 0; i < q; i++)
    {
        char c[3];
        int x;

        scanf("%1s %d", c, &x);
        if(c[0] == '+') t = update(t, x, 1);
        else t = update(t, x, -1);

        printf("%d\n", t->g == 0 ? 1 : t->g);
    }
    return 0;
}
