#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <time.h>
 
using namespace std;

typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)

#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  map<string,ll> ma;
  rep(i,0,n){
    string s;
    cin>>s;
    string s1;
    if(s[0]=='!'){
      rep(j,1,s.sz){
        s1 += ctos(s[j]);
      }
      ma[s1] |= 2;
    }
    else{
      ma[s] |= 1;
    }
  }
  map<string,ll>::iterator itr = ma.begin();
  while(itr!=ma.end()){
    string a = (*itr).fi;
    ll b = (*itr).se;
    if(b==3){
      cout << a << endl;
      return 0;
    }
    itr++;
  }
  cout << "satisfiable" << endl;
  return 0;
}
#include <bits/stdc++.h>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int64_t n;
    std::cin >> n;
    for (int64_t a = 1, p = 3; p <= n; ++a, p *= 3) {
        for (int64_t b = 1, q = 5; q <= n; ++b, q *= 5) {
            if (p + q == n) {
                std::cout << a << " " << b << "\n";
                return 0;
            }
        }
    }
    std::cout << -1 << "\n";
    
    return 0;
}