#include <bits/stdc++.h>
using namespace std;
char a, b, c, d, s;
int main() {
  cin >> a >> b >> c >> d;
  if ((a == 'b' && d == 'd') || (a == 'd' && d == 'b') ||
      (a == 'p' && d == 'q') || (a == 'q' && d == 'p'))
    s++;
  if ((b == 'b' && c == 'd') || (b == 'd' && c == 'b') ||
      (b == 'p' && c == 'q') || (b == 'q' && c == 'p'))
    s++;
  if (s == 2) cout << "YES" << endl;
  if (s != 2) cout << "NO" << endl;
  return 0;
}
