#include <bits/stdc++.h>
using namespace std;
int ok[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string second =
      "H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co "
      "Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb "
      "Te I Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re "
      "Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es "
      "Fm Md No Lr Rf Db Sg Bh Hs Mt Ds Rg Cn Nh Fl Mc Lv Ts Og";
  string t;
  cin >> t;
  for (int i = 0; i < (signed)(t.length()); i++) {
    if (second.find(t.substr(i, 1) + " ") != string::npos) {
      if (i == 0 || ok[i - 1]) ok[i] = true;
    }
    if (i != 0) {
      string aah = t.substr(i - 1, 2);
      aah[1] = aah[1] - 'A' + 'a';
      if (second.find(aah) != string::npos) {
        if (i == 1 || ok[i - 2]) ok[i] = true;
      }
    }
  }
  if (ok[t.length() - 1])
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
