#include<bits/stdc++.h>
using namespace std;
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define fr2(i,a,b) for(int i=a;i>=b;i--)
#define fr3(i,a,b) for(int i=a;i<=b;i++)
#define umap unordered_map<int,int,custom_hash>
#define omap map<int,int>
#define uset unordered_set<int,custom_hash>
#define oset set<int>
#define pr pair<int,int>
#define mod 1000000007
#define mp make_pair
#define all(v) v.begin(),v.end()
#define ppb pop_back

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve()
{
  int n,m;
  cin>>n>>m;
  map<int,int> map1;
  fr1(i,0,n)
  {
    int x;
    cin>>x;
    map1[x]++;
  }
  fr1(i,0,m)
  {
    int x;
    cin>>x;
    map1[x]++;
  }
  for(auto i:map1)if(i.sc==1)cout<<i.fr<<" ";
  cout<<"\n";

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    fr3(i,1,t){
      //cout<<"Case: "<<t<<;
        solve();
    }
   return 0;
}
#include <bits/stdc++.h>
#define F first
#define S second
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define RFOR(i, a, b) for(int i = a; i >= b; i--)
#define all(v) ((v).begin()), ((v).end())
#define endl '\n'

using namespace std;
using ll     = long long;
using ull    = unsigned long long;
using Graph  = vector<vector<int>>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vll    = vector<ll, ll>;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using BigInt = __int128;



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

  string s;
  cin >> s;

  if(s.size() == 1){
    cout << (stoi(s) % 8 ? "No" : "Yes");
    return 0;
  }

  if(s.size() == 2){
    if(stoi(s) % 8 == 0) 
      return cout << "Yes", 0;
    swap(s[0], s[1]);
    if(stoi(s) % 8 == 0) 
      return cout << "Yes", 0;
    return cout << "No", 0;
  }

  map<int, int> lookup;

  for (const auto& c : s)
    lookup[c-'0']++;

  for (int i = 100; i < 1000; i++) {
    if (i % 8) continue;
    int t = i;
    vi digits;
    while (t) digits.push_back(t%10), t/=10;

    bool ok = true;
    for (const auto& d : digits) {
      if (lookup[d] <= 0) ok = false; 
      lookup[d]--;
    }

    if(ok) return cout << "Yes", 0;

    for (const auto& d : digits) 
      lookup[d]++;
  }
  cout << "No";
}
