#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;

#define ll long long int
#define pb push_back
#define Messi ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<pair<ll,ll>, ll>
#define mod 1000000007
#define vi vector<ll>
#define vii vector<pii>
#define all(v) v.begin(),v.end()
#define mi map<ll, ll>
//Never Let U Go!!

int main()
{
    Messi;
    ll n;
    cin>>n;
    vector<pii>v;
    for(ll i=0;i<n;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        v.pb({{a,c},b});
    }
    ll ans=LONG_MAX;
    for(auto g:v)
    {
        ll t= g.first.first;
        if(t<g.first.second)
           ans=min(ans,g.second);
    }
    if(ans==LONG_MAX)
    cout<<"-1";
    else
    cout<<ans;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int n;
cin >> n;
vector<string> s(n);
set<string> st;
for(int i=0;i<n;i++){
    cin >> s[i];
    st.insert(s[i]);
}
for(int i=0;i<n;i++){
    if(s[i][0]!='!'){
        if(st.count('!'+s[i])>=1){
            cout << s[i] << endl;
            return 0;
        }
    }
}
cout << "satisfiable" << endl;
 
}