#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string a[200100], b[200100];
int main()
{
    int n;
    cin >> n;
    
    string p, t;
    int numa = 0, numb = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> p;
        if (p[0] == '!')
        {
            t = "";
            for (int x = 1; p[x] != 0; x++)t += p[x];
            b[numb++] = t;
        }
        else a[numa++] = p;
    }
    sort(a, a + numa);
    sort(b, b + numb);
    for (int i = 0; i < numb; i++)
        if (binary_search(a, a + numa, b[i]))
        {
            cout << b[i];
            return 0;
        }
    cout << "satisfiable";
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long double ld;
#define int long long
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define vii vector<int>
#define pii pair<int,int>
#define piii pair<int, pii>
#define yes cout<<"YES\n";
#define no  cout<<"NO\n";
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define PI 3.1415926535897932384626433832795
#define dec(x) fixed<<setprecision(x)
#define tc int t;cin>>t;while(t--)
#define pr(x) for(auto it : x)cout<<it<<" ";
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a*b/__gcd(a,b))
#define fi(i,n) for(int i=0;i<n;i++)
#define f(i, a, b) for(int i=a;i<b;i++)
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
#define cint4(a,b,c,d) int a,b,c,d;cin>>a>>b>>c>>d
#define all(v)  v.begin(),v.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL); 
#define endl cout<<"\n";
#define print1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<" ";}endl;}
#define scan1(a,n) for(int i=1;i<=n;i++) cin>>a[i]
#define scan(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "
#define cout1(a) cout<<a;endl
#define cout2(a,b) cout<<a<<" "<<b;endl
#define cout3(a,b,c) cout<<a<<" "<<b<<" "<<c;endl
#define cout4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d;endl
 
map<int,int>mp;

int comp(int a, int b){
    return (a>b);
}

bool prime(int n)
{
   if(n==0 or n==1) return false;
   if(n==2) return true;
   else if(n%2==0) return false;
   for(int i=3;i*i<=n;i+=2)
   {
       if(n%i==0)
       {
           return false;
       }
   }
   return true;
}

int binCo(int n, int r){
    int C[n+1][r+1];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=min(i,r);j++)
        {
            if(j==0 or j==i)
            C[i][j] = 1;
            else
            C[i][j] = C[i-1][j] + C[i-1][j-1];
        }
    }
    return C[n][r];
}

//Modular Exponentiation O(Log y)
int power(int x, int y, int MODL) {
	int res = 1;
	x = x % MODL;
	while (y > 0) {
		if (y & 1)
			res = (res*x) % MODL;
		y = y>>1;
		x = (x*x) % MODL;
	}
	return res;
}
 
//Fermat's Little theorem, O(Log m)
int modInverse(int a, int m) {
	   return power(a, m-2, m);
}
int binSearch(int arr[], int n, int x)
{
    int l = 0, r=n-1;
    while(l<=r)
    {
        int mid = (l+r)/2;
        if(x==arr[mid])
        return mid;
        if(x>arr[mid])
        {
           l = mid+1;
        }
        else
        if(x<arr[mid])
        {
            r = mid-1;
        }
    }
    return -1;
}

bool sortBySec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

void solve()
{
   int n;
   cin>>n;
   map<int,string>mp;
   vii v(n),v2;
   for(int i=0; i<n; i++){
       string s;int n1;
       cin>>s>>n1;
       v[i] = n1;
       mp[v[i]] = s;
   }
   int mx = *max_element(all(v));
   for(int i=0;i<n;i++){
       if(v[i]!=mx)v2.pb(v[i]);
   }
   mx  = *max_element(all(v2));
   cout<<mp[mx];
   
}
int32_t main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    solve();
    return 0;
}