#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int main(){
  string s;
  cin>>s;
  
  if(s.size()<3){
    if(s.size()==1){
      if(s == "8"){
        cout << "Yes" << endl;
        return 0;
      }
      cout << "No" << endl;
      return 0;
    }
    int a = s[0]-'0';
    int b = s[1]-'0';
    if((10*a+b)%8 == 0 || (10*b+a)%8 == 0){
      cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
  }
  
  int test[10];
  int test2[10];
  int test3[113] = {000,104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, 528, 536, 544, 552, 560, 568, 576, 584, 592, 600, 608, 616, 624, 632, 640, 648, 656, 664, 672, 680, 688, 696, 704, 712, 720, 728, 736, 744, 752, 760, 768, 776, 784, 792, 800, 808, 816, 824, 832, 840, 848, 856, 864, 872, 880, 888, 896, 904, 912, 920, 928, 936, 944, 952, 960, 968, 976, 984, 992};
  rep(x,10){
    test[x] = 0;
    test2[x] = 0;
  }  
  rep(i,int(s.size())){
    int a = s[i] - '0';
    test[a]++;
  }
  rep(i,113){
    rep(j,10) test2[j] = 0;
    int a,b,c;
    a = test3[i]%10;
    b = test3[i]/100;
    c = (test3[i]%100)/10;
    test2[a]++;
    test2[b]++;
    test2[c]++;
    rep(j,10){
      if(test2[j]>test[j]) break;
      if(j == 9){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;
  #define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
  #define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)


int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS


    set<string> ss,sss;


    int n;
    cin >> n;

    while(n--)
    {
        string s;
        cin >> s;

        if(s[0] == '!')
        {
            string str;
            for(int i = 1; i< s.size(); i++)
            {
                str.push_back(s[i]);
            }
            sss.insert(str);
        }
        else
        {
            ss.insert(s);
        }


    }


    for(auto &i : ss)
    {
        if(sss.count(i))
        {
            cout << i ;
            return 0;
        }
    }

    cout << "satisfiable";
    return 0;
}
