#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
inline ull Hash(const string& s){
    ull ans=0;
    for(auto c : s)
        ans=ans*26+c-'a';
    return ans;
}
string s;
int N;
set<ull> s1,s2;
inline void work(){
    for(int i=1;i<=N;i++){
        cin>>s;
        set<ull> &t1=(s[0]=='!'?s1:s2);
        set<ull> &t2=(s[0]!='!'?s1:s2);
        reverse(s.begin(),s.end());
        if( *s.rbegin()=='!' ) s.pop_back();
        ull val=Hash(s);
        if( t1.find(val)!=t1.end() ){
            reverse(s.begin(),s.end());
            cout<<s<<endl;
            return ;
        }
        else t2.insert(val);
    }
    cout<<"satisfiable"<<endl;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>N;
    work();
    return 0;
}
#include<bits/stdc++.h>
using namespace std;

struct{template<class T>constexpr operator T(){return numeric_limits<T>::max();}constexpr auto operator-();}inf;
struct{template<class T>constexpr operator T(){return numeric_limits<T>::lowest();}constexpr auto operator-();}negative_inf;
constexpr auto decltype(inf)::operator-(){return negative_inf;}
constexpr auto decltype(negative_inf)::operator-(){return inf;}

#define swap(a,b) {a^=b;b^=a;a^=b;}
#define rep(i,n) for(long long i = 0; i < n; i++)
#define reps(i,s,n) for(long long i = (s); i < n; i++)
#define repr(i,n) for(long long i = (n - 1); i >= 0; i--)
#define LOOP for(long long i = 0;;i++)
#define PB push_back
#define ALL(v) v.begin(),v.end()
#define DOUBLE fixed << setprecision(15)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<vd> vvd;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
typedef pair<ll,ll> P;
typedef vector<P> vP;

#define F first
#define S second
#define SPC << " "

ll gcd(ll x,ll y){if(x<=0||y<=0)return 0;if(y>x){swap(x,y);}return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*y/gcd(x,y);}
ll factrial(int x){return x<=1?1:x*factrial(x-1);}
ll nPr(ll n,ll r){ll a=1;rep(i,n-r)a*=(n-i);return a;}
ll nCr(ll n,ll r){ll a=1;rep(i,r){a*=(n-i);a/=(i+1);}return a;}
vP factor(ll n){vP r;if(n<=1)return{};ll m=pow(n,0.5)+1;reps(i,2,m){if(n%i==0){ll c=0;
  while(n%i==0){c++;n/=i;}r.PB({i,c});}if(n<=1)break;}if(n>1)r.PB({n,1});return r;}

int main(){
  string s;
  cin >> s;
  string o;
  rep(i,s.length()){
    if(s[i]=='6') s[i] = '9';
    else if(s[i]=='9') s[i] = '6';
  }
  repr(i,s.length()){
    cout << s[i];
  }
  cout << endl;
}