a = input()
b = int(input())
if (a=="ABC" and b<2000) or (a=="ARC" and b<2800) or (a=="AGC" and b>=1200):
print('YES')
else:
print('NO')
#include<vector>
#include<string>
#include<math.h>
#include<bits/stdc++.h>
#define el '\n'
using ll=long long ;
//#define ll long long
#define all(x) (x).begin(),(x).end()
#define dl double
#include<algorithm>
#define print(x) cout << (x) << '\n'
/******************************************************
| rammah is typeing يواد |
|======================================================|
|نبدأ بقى سباكه بما يرضي الله|
|======================================================|
*******************************************************/
using namespace std;
const int N=10005;
ll freq[N];
ll pre[N];
ll gcd( ll a,ll b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
return (a / gcd(a, b)) * b;
}
ll zam[101];
struct point
{
int x;
int y;
};
bool cop(pair<string,int>a,pair<string,int>b)
{
if(a.second==b.second) return a.first<b.first;
else a.second<b.second;
}
bool isGoodArray(const vector<int>& a) {
int n = a.size();
int sum_a = 0;
for (int i = 0; i < n; i++) {
sum_a += a[i];
}
int sum_n = n * (n + 1) / 2;
if (sum_a != sum_n) {
return false;
}
return true;
}
bool check(int mid, vector<int>& v, vector<int>& a, int n, int k) {
int operations = 0;
for (int i = 0; i < n - 1; i++) {
operations += max(0, mid - a[i]);
if (operations > k) {
return false;
}
}
return true;
}
int fac(int num) {
int fact = 1;
for (int i = 2; i <= num; i++) {
fact *= i;
}
return fact;
}
int cal(int n, int m) {
int combinations = fac(n) / (fac(m) * fac(n - m));
return combinations;
}
vector<int> restoreArray(vector<int>& b, int n) {
sort(b.begin(), b.end());
vector<int> a(n);
int i = 0;
for (int j = 0; j < n; j++) {
a[j] = b[i];
i += (n - j);
if (i >= b.size()) {
break;
}
}
return a;
}
void FastCode() {std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
void they_call_me_007()
{
//freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout);
}
ll fac(ll n)
{
int ans=1;
for(int i=1;i<=n;i++) ans*=i;
return ans;
}
// قَالَ إِنَّمَا أَشْكُو بَثِّي وَحُزْنِي إِلَى اللَّهِ وَأَعْلَمُ مِنَ اللَّهِ مَا لا تَعْلَمُونَ
void work(/**/)
{
string str;cin>>str; int n;cin>>n;
if ((str=="ABC" and n<2000) or (str=="ARC" and n<2800) or (str=="AGC" and n>=1200)) cout<<"YES"<<el;else cout<<"NO"<<el;
}
signed main()
{
FastCode();
they_call_me_007();
int T;
T=1;
//cin>>T;
while(T--)
{
work();
}
}
137. Single Number II | 130. Surrounded Regions |
129. Sum Root to Leaf Numbers | 120. Triangle |
102. Binary Tree Level Order Traversal | 96. Unique Binary Search Trees |
75. Sort Colors | 74. Search a 2D Matrix |
71. Simplify Path | 62. Unique Paths |
50. Pow(x, n) | 43. Multiply Strings |
34. Find First and Last Position of Element in Sorted Array | 33. Search in Rotated Sorted Array |
17. Letter Combinations of a Phone Number | 5. Longest Palindromic Substring |
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |