#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long double PI = acos(-1.0);
// #include <atcoder/all>
// using namespace atcoder;

signed main() {
    int N;
	cin >> N;
	map<string, int> mp;
	rep(i,N){
		string S;
		cin >> S;
		int M = S.size();
		bool ok = false;
		if(S[0] == '!'){
			ok = true;
			S = S.substr(1);
		}
		if(ok) mp[S] += 10000000;
		else mp[S]++;
	}
	for(auto p : mp){
		int x = p.second/10000000;
		int y = p.second%10000000;
		if(x > 0 && y > 0){
			cout << p.first << endl;
			return 0;
		}
	}
	cout << "satisfiable" << endl;
}
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;

using namespace std;
using Graph = vector<vector<int>>;

int main(){
    int n;  cin >> n;
    int ma, mi;
    mi = 0;
    vector<int> c(200001,0);
    for(int i=0; i<n; i++){
        int p;  cin >> p;
        c[p] = 1;
        if(c[mi] == 0)  print(mi);
        else{
            while(mi <= 200000){
                mi++;
                if(c[mi] == 0){
                    print(mi);
                    break;
                }
            }
        }
    }
}