#include <iostream>
#include <string>
#define rep(I, N) for (int I = 0; I < (N); ++I)
using namespace std;
int main() {
  string s;
  cin >> s;
  string t = "ZONe";
  int c = 0;
  size_t pos = -1;
  while ((pos = s.find(t, pos + 1)) != string::npos) {
    c++;
  }
  cout << c << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll inf = 1e18;


int n;

const int N = 2e5 + 5;
vector<string> arr;
set<string> dang;

void init() {
}

void input() {
    cin >> n;

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        if (s[0] == '!') {
            dang.insert(s);
        }
        else {
            arr.pb(s);
        }
    }
}

void solve() {
    for (auto s : arr) {
        string now = '!' + s;

        if (dang.find(now) != dang.end()) {
            cout << s;

            return;
        }
    }

    cout << "satisfiable";
}

void output() {
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int number_of_testcases = 1;
    //cin >> number_of_testcases;
    while (number_of_testcases--) {
        init();

        input();

        solve();

        output();
    }

    return 0;
}
