#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

int sToInt(string s) {
    int ret = 0;
    int sign = 1;

    int i = 0;
    if (s[0] == '-') {
        i++;
        sign = -1;
    }

    while (i < s.size()) {
        ret *= 10;
        ret += s[i] - '0';
        i++;
    }

    return ret * sign;
}

void solve(int N) {
    const int INF = 1e12;
    V a(N + 2);
    a[0] = INF;
    a[N + 1] = ((N + 1) % 2 ? -1 : 1) * INF;
    V dead(N + 2, false);
    bool exist_x = false;

    rep2(i, 1, N + 1) {
        string s;
        cin >> s;
        if (s[0] == 'x') {
            dead[i] = true;
            exist_x = true;
        } else {
            a[i] = sToInt(s);
        }
    }

    // rep(i, a.size()) cout << a[i] << " ";
    // cout << endl;
    // rep(i, dead.size()) cout << dead[i] << " ";
    // cout << endl;

    rep2(i, 1, N + 1) {
        if (!dead[i] && !dead[i + 1]) {
            if (i % 2 == 1 && !(a[i] < a[i + 1])) {
                cout << "none" << endl;
                return;
            }
            if (i % 2 == 0 && !(a[i] > a[i + 1])) {
                cout << "none" << endl;
                return;
            }
        }
        if (dead[i] && dead[i + 1]) {
            cout << "none" << endl;
            return;
        }
    }

    if (!exist_x) {
        cout << "ambiguous" << endl;
        return;
    }

    int lb = -INF;
    int ub = INF;
    rep2(i, 1, N + 1) {
        if (dead[i]) {
            if (i % 2 == 1) {
                ub = min(ub, a[i - 1] - 1);
                ub = min(ub, a[i + 1] - 1);
            }
            else {
                lb = max(lb, a[i - 1] + 1);
                lb = max(lb, a[i + 1] + 1);
            }
        }
    }
    // cout << "lb = " << lb << ", ub = " << ub << endl;

    if (lb == ub)       cout << lb << endl;
    else if (lb > ub)   cout << "none" << endl;
    else                cout << "ambiguous" << endl;

}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int N;
    while (cin >> N, N) {
        solve(N);
    }
}