#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, c) for(int i = 0; i < (int)c; i++)
const int inf = 1000000000; // 10^9
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; }
//vector<vector<int>> vv(n, vector<int>(m));

int main(){
    int N;
    cin >> N;

    vector<string> S(N);

    rep(i,N) cin >> S[i];

    map<string,int> M; //stringの番地にintを立てれる．

    string wow = "!";

    rep(i,N){
        M[S[i]] = 1;
        if(S[i][0]=='!'){ //先頭が!のとき
            string temp;
            temp = S[i];
            temp.erase(temp.begin());
            if(M[temp]==1){
                cout << temp << endl;
                return 0;
            }
        }
        else{
            string temp2 = wow + S[i];
            if(M[temp2]==1){
                cout << S[i] << endl;
                return 0;
            }
        }
    }
    cout << "satisfiable" << endl;
}
#include <bits/stdc++.h> 
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)


int main() {
  ll N;cin>>N;
 vector<vector<ll>> vec(N,vector<ll> (5));
 for(ll i=0;i<N;i++) {
   for(ll j=0;j<5;j++) {
     cin>>vec[i][j];
   }
 }
 
ll s=1;
ll g=1e9+1;

while(s<g) {
  ll k=(s+g+1)/2;
  set<ll> Q;
  vector<ll> note(0);
  for(ll i=0;i<N;i++) {
   ll S=0;
    for(ll j=0;j<5;j++) {
      if(vec[i][j]>=k) {
        S|=(1<<j);
      }
    }
   
      Q.insert(S);
    
    }
  
  bool b=false;
for(auto x:Q) {
  for(auto y:Q) {
    for(auto z:Q) {
      ll a=x|y|z;
      if(a==(1<<5)-1) b=true;
    }
  }
}

if(b) s=k;
else g=k-1;
}

  

  cout<<s<<endl;
}


   