#include <bits/stdc++.h>
using namespace std;

int main() {
  string A,B,C; cin >> A >> B >> C;
  int a,b,c;
  a = A.size();
  b = B.size();
  c = C.size();
  char s,t,u,v;
  s = A.at(a-1);
  t = B.at(0);
  u = B.at(b-1);
  v = C.at(0);
  if (s == t && v == u){
    cout << "YES";
  }
  else cout << "NO";
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    vector<int>x(N);
    vector<int>y(M);
    for(int i = 0; i < N; i++) {
        cin >> x[i];
    }
    for(int i = 0; i < M; i++) {
        cin >> y[i];
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    if(x[N-1] < y[0]) {
        if(y[0] > X && x[N-1] < Y) {
            cout << "No War" << endl;
            return 0;
        } 
    }
    cout << "War" << endl;
}