#include #include "bits/stdc++.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; const int INF = 1e8; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) using namespace std; typedef pair P; int string_int(string s){ stringstream ss; ss<>n; return n; } int main() { string a, b; cin >> a >> b; if (a[0] - '0' == 0 && a.length() > 1) { cout << "NG" << endl; return 0; } if (b[0] - '0' == 0 && a.length() > 1) { cout << "NG" << endl; return 0; } int tmp = 0; for (int i = 0; i < a.length(); i++) { tmp = a[i] - '0'; if ( tmp > 9) { cout << "NG" << endl; return 0; } } for (int i = 0; i < a.length(); i++) { tmp = b[i] - '0'; if (tmp > 9) { cout << "NG" << endl; return 0; } } int r,t; r = string_int(a); t = string_int(b); if(r>=0 && r<=12345 && t >=0 && t<=12345){ cout<<"YES"<