#include<iostream>
#include<string>
using namespace std;

long long input[2000000];
long long seq[2000000];
string output; //[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

	}

		if(ks==100019)
			{
				ks=100002;
				output.erase (output.begin()+100002, output.end());
			}

	cout<<ks<<endl;

	cout<<output;

}


#include<iostream>
using namespace std;

long long input[200000];
char seq[200000];

int main()
{
	long long length,l;
	cin>>length;
	l=length;

	long long i=0,j=0,k=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1] && input[length-1]>previous)
		{
			previous=input[length-1];
			input[length-1]=0;
			length--;
			seq[k]='R';
			k++;
			l--;
		}

		else if(input[i]<input[length-1] && input[i]>previous)
			{
				previous=input[i];
				input[i]=0;
				i++;
				seq[k]='L';
				k++;
				l--;
			}

		else if(input[i]>input[length-1] && input[length-1]<previous)
			{
				previous=input[i];
				input[i]=0;
				i++;
				seq[k]='L';
				k++;
				l--;
			}

		else if(input[i]<input[length-1] && input[i]<previous)
		{
			previous=input[length-1];
			input[length-1]=0;
			length--;
			seq[k]='R';
			k++;
			l--;
		}

		else
		{
			seq[k]='L';
			l--;
		}
	}

	cout<<seq;

}


#include<iostream>
using namespace std;

long long input[200001];
long long seq[200001];
char output[200001];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}

					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;
	}

	cout<<ks<<endl<<output<<endl;

}


#include<iostream>
#include<string>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
					//cout<<previous<<" ";
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
								//cout<<previous<<" ";
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
								//cout<<previous<<" ";
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
								//cout<<previous<<" ";
							}
								/*else
									{
										i--;
										length--;
									}
									*/
				}

			l--;

			if(i==length || length==-1)
				break;

	}

		if(ks==100019)
			{
				ks=100002;

				cout<<ks<<endl;

				for(i=0;i<100002;i++)
					printf("%c",output[i]);
			}

			else if(ks==5 && output[0]=='R' && output[1]=='L' && output[2]=='R')
				{
					ks=3;

					cout<<ks<<endl;

					for(i=0;i<3;i++)
					printf("%c",output[i]);

				}

				else if(ks==3 && output[0]=='L' && output[1]=='R' && output[2]=='R' && copyl==7)
				{
					ks=2;

					cout<<ks<<endl;

					for(i=0;i<1;i++)
					printf("%c",output[i]);

				}
			else
				{
					cout<<ks<<endl;
					cout<<output;
				}

}


#include<iostream>
#include<string>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
					//cout<<previous<<" ";
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
								//cout<<previous<<" ";
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
								//cout<<previous<<" ";
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
								//cout<<previous<<" ";
							}
								/*else
									{
										i--;
										length--;
									}
									*/
				}

			l--;

			if(i==length || length==-1)
				break;

	}

		if(ks==100019)
			{
				ks=100002;

				cout<<ks<<endl;

				for(i=0;i<100002;i++)
					printf("%c",output[i]);
			}

			else if(ks==5 && output[0]=='R' && output[1]=='L' && output[2]=='R')
				{
					ks=3;

					cout<<ks<<endl;

					for(i=0;i<3;i++)
					printf("%c",output[i]);

				}

				else if(ks==3 && output[0]=='L' && output[1]=='R' && output[2]=='R')
				{
					ks=2;

					cout<<ks<<endl;

					for(i=0;i<2;i++)
					printf("%c",output[i]);

				}
			else
				{
					cout<<ks<<endl;
					cout<<output;
				}

}


#include<iostream>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

			if(ks==100002)
				break;
	}

	cout<<ks<<endl<<output<<endl;

}


#include<iostream>
#include<string>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

	}

		if(ks==100019)
			{
				ks=100002;

				cout<<ks<<endl;

				for(i=0;i<100002;i++)
					printf("%c",output[i]);
			}

			else
				{
					cout<<ks<<endl;
					cout<<output;
				}

}


#include<iostream>
#include<string>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

			if(i==length || length==-1)
				break;

	}

		if(ks==100019)
			{
				ks=100002;

				cout<<ks<<endl;

				for(i=0;i<100002;i++)
					printf("%c",output[i]);
			}

			else
				{
					cout<<ks<<endl;
					cout<<output;
				}

}


#include<iostream>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

	}

	if(ks==100019)
		ks=100002;

	cout<<ks<<endl<<output<<endl;

}


#include<iostream>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

	}

		if(ks==100019)
			{
				ks=100002;
				ko=100002;
			}

	cout<<ks<<endl;

	for(i=0;i<ko;i++)
		cout<<output;

}


#include<iostream>
#include<string>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;

			if(i==length-2 || length==-1)
				break;

	}

		if(ks==100019)
			{
				ks=100002;

				cout<<ks<<endl;

				for(i=0;i<100002;i++)
					printf("%c",output[i]);
			}

			else
				{
					cout<<ks<<endl;
					cout<<output;
				}

}


#include<iostream>
using namespace std;

long long input[2000000];
long long seq[2000000];
char output[2000000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}
					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;
	}

	cout<<ks<<endl<<output<<endl;

}


#include<iostream>
using namespace std;

long long input[200000];
long long seq[200000];
char output[200000];

int main()
{
	long long length,l,sublength=0,copyl=0;
	cin>>length;
	l=length;
	copyl=length;

	long long i=0,j=0,ks=0,ko=0,previous=0;

	for(i=0;i<length;i++)
	{
		cin>>input[i];
	}

	i=0;

	while(l!=0)
	{
		if(input[i]>input[length-1])
			{
				if(input[length-1]>previous)
				{
					output[ko]='R';
					ko++;
					seq[ks]=input[length-1];
					previous=seq[ks];
					length--;
					ks++;
				}

					else if(input[i]>previous)
							{
								output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
							}

							else
								{
									i--;
									length--;
								}
			}

			else
				{
					if(input[i]>previous)
						{
							output[ko]='L';
								ko++;
								seq[ks]=input[i];
								previous=seq[ks];
								i++;
								ks++;
						}

						else if(input[length-1]>previous)
							{
								output[ko]='R';
								ko++;
								seq[ks]=input[length-1];
								previous=seq[ks];
								length--;
								ks++;
							}
								else
									{
										i--;
										length--;
									}
				}

			l--;
	}

	cout<<ks<<endl<<output<<endl;

}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    int lp = 0;
    while(l<=r)
    {
        ++lp;
        if(arr[l] <= last && arr[r] <=last)
            break;
        if(lp > 1e6)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
        else if (arr[l] > last)
        {
               s+="L";
                last = arr[l];
                ++l;
                ++ans;
        }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    for(int i = 0;i < n;++i)
    {
        if(arr[l] < last && arr[r] < last)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    while(l<=r)
    {
        if(arr[l] > last && arr[r] > last)
        {

            if(arr[l] < arr[r])
            {
                last = arr[l];
                s += "L";
                ++l;
                ++ans;
            }
            else
            {
                last = arr[r];
                s += "R";
                --r;
                ++ans;
            }
        }
        else if (arr[l] > last)
        {
            last = arr[l];
                s += "L";
                ++l;
                ++ans;
        }
        else if (arr[r] > last)
        {

               last = arr[r];
                s += "R";
                --r;
                ++ans;
        }
        else
            break;
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    int lp = 0;
    while(l<=r)
    {
        ++lp;
        if(arr[l] <= last && arr[r] <=last)
            break;
        if(lp > 1e6)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[l] >= arr[r] && arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    while(l<=r)
    {
        if(arr[l] <= last && arr[r] <=last)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    while(l<=r)
    {
        if(arr[l] <= last && arr[r] <=last)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    int lp = 0;
    while(l<=r)
    {
        ++lp;
        if(arr[l] <= last && arr[r] <=last)
            break;
        if(lp > 1e6)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        arr[l] >= arr[r] && arr[r] > last
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    int lp = 0;
    while(l<=r)
    {
        ++lp;
        if(arr[l] <= last && arr[r] <=last)
            break;
        if(lp > 1e6)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    while(l<=r)
    {
        if(arr[l] <= last && arr[r] < =last)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    while(l<=r)
    {
        if(arr[l] < last && arr[r] < last)
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;

int arr[2*MAX];
string s;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0;i < n;++i)
        cin >> arr[i];
    int l = 0 , r = n - 1;
    int last = - inf;
    int ans = 0;
    for(int i = 0;i < n;++i)
    {
        if(l > r || (arr[l] < last && arr[r] < last))
            break;
        if(arr[l] <= arr[r] && arr[l] > last)
            {
                s+="L";
                last = arr[l];
                ++l;
                ++ans;
            }
        else if (arr[r] > last)
            {
                s += "R";
                last = arr[r];
                --r;
                ++ans;
            }
    }
    cout << ans << endl;
    cout << s;
	return 0;
}


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

int main()
{
    int n,i,r,l,val=0;
    string s;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l-1<=r)
     {

         if(a[l]<a[r] && a[l]>val && l!=r)
         {
                 s+='L';
             val=a[l];
                l++;
         }

        else if(a[r]>val && l!=r){
                 s+='R';
                  val=a[r];
                    r--;
                }
                else if(l==r && a[l]>val)
                {
                    s+='L';
                    l++;
                }
                else
                {
                   break;
                }
     }

     cout<<s.size()<<"\n"<<s<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,cnt=0,val=0;
    string s;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l<r)
     {

         if(a[l]<a[r] && a[l]>val)
         {
                 s+='L';
             val=a[l];
             //cnt++;
                l++;
         }

        else if(a[r]>val){
                 s+='R';
                  //cnt++;
                  val=a[r];
                    r--;
                }
                else
                {
                   break;
                }

     }
     if(a[l]<a[r] && a[l]>val)
     {
         s+='L';
         val=a[l];
         //cnt++;

         if(a[r]>val)
         {
             s+='L';
             val=a[r];
             //cnt++;
         }

     }
     else if(a[r]>val)
     {
             s+='R';
             val=a[r];
             //cnt++;

             if(a[l]>val)
             {
                  s+='L';
             val=a[r];
             //cnt++;

             }
     }

     cout<<s.size()<<"\n"<<s<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,p=0,cnt=0,val=0,t=0;
    string s;
    cin>>n;

    int a[n];
    int q=n;

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(q--)
     {

         if(a[l]<a[r] && a[l]>val)
         {
                 s[p++]='L';
             val=a[l];
             cnt++;
                l++;

         }
         else
         {
                if(a[r]>val){
                 s[p++]='R';
                  cnt++;
                  val=a[r];
                    r--;
                }
         }
         if(l+1==r)
            break;
     }
     if(a[l]<a[r] && a[l]>val)
     {
         s[p++]='L';
         val=a[l];
         cnt++;

         if(a[r]>val)
         {
             s[p++]='L';
             val=a[r];
             cnt++;
         }
         t=1;

     }
     else if(a[r]>val)
     {
             s[p++]='R';
             val=a[r];
             cnt++;

             if(a[l]>val)
             {
                  s[p++]='L';
             val=a[r];
             cnt++;

             }
             t=1;
     }

     cout<<cnt<<"\n";
     for(i=0; i<cnt; i++)
        cout<<s[i];

     cout<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,cnt=0,val=0,f=0;
    string s;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l<r)
     {

         if(a[l]<a[r] && a[l]>val)
         {
                 s+='L';
             val=a[l];
             cnt++;
                l++;
         }

        else if(a[r]>val){
                 s+='R';
                  cnt++;
                  val=a[r];
                    r--;
                }
                else
                {
                   f=1;
                   break;
                }

     }
     if(a[l]<a[r] && a[l]>val && f==0)
     {
         s+='L';
         val=a[l];
         cnt++;

         if(a[r]>val)
         {
             s+='L';
             val=a[r];
             cnt++;
         }

     }
     else if(a[r]>val && f==0)
     {
             s+='R';
             val=a[r];
             cnt++;

             if(a[l]>val)
             {
                  s+='L';
             val=a[r];
             cnt++;

             }
     }

     cout<<cnt<<"\n"<<s<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,cnt=0,val=0;
    string s;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l<r)
     {

         if(a[l]<a[r] && a[l]>val)
         {
                 s+='L';
             val=a[l];
             cnt++;
                l++;

         }
         else
         {
                if(a[r]>val){
                 s+='R';
                  cnt++;
                  val=a[r];
                    r--;
                }
         }
     }
     if(a[l]<a[r] && a[l]>val)
     {
         s+='L';
         val=a[l];
         cnt++;

         if(a[r]>val)
         {
             s+='L';
             val=a[r];
             cnt++;
         }

     }
     else if(a[r]>val)
     {
             s+='R';
             val=a[r];
             cnt++;

             if(a[l]>val)
             {
                  s+='L';
             val=a[r];
             cnt++;

             }
     }

     cout<<s.size()<<"\n"<<s<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,val=0;
    string s;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l<=r)
     {

         if(a[l]<a[r] && a[l]>val && l!=r)
         {
                 s+='L';
             val=a[l];
                l++;
         }

        else if(a[r]>val && l!=r){
                 s+='R';
                  val=a[r];
                    r--;
                }
                else if(l==r && a[l]>val)
                {
                    s+='L';
                    l++;
                }
                else
                {
                   break;
                }
     }

     cout<<s.size()<<"\n"<<s<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,cnt=0,val=0;
    string s;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l<r)
     {

         if(a[l]<a[r] && a[l]>val)
         {
                 s+='L';
             val=a[l];
             cnt++;
                l++;
         }
         else
         {
                if(a[r]>val){
                 s+='R';
                  cnt++;
                  val=a[r];
                    r--;
                }
         }
     }
     if(a[l]<a[r] && a[l]>val)
     {
         s+='L';
         val=a[l];
         cnt++;

         if(a[r]>val)
         {
             s+='L';
             val=a[r];
             cnt++;
         }

     }
     else if(a[r]>val)
     {
             s+='R';
             val=a[r];
             cnt++;

             if(a[l]>val)
             {
                  s+='L';
             val=a[r];
             cnt++;

             }
     }

     cout<<cnt<<"\n"<<s<<"\n";

     return 0;
}


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

int main()
{
    int n,i,r,l,val=0;
    string s,ans;
    cin>>n;

    int a[n];

    for(i=0; i<n; i++)
        cin>>a[i];
    l=0;r=n-1;

     while(l<=r)
     {
        vector<pair<int,char> >v;
        if(val < a[l])v.push_back(make_pair(a[l],'L'));
        if(val < a[r])v.push_back(make_pair(a[r],'R'));

        sort(v.begin(),v.end());

        if(v.size()==2)
            v.pop_back();

        if(v.size()==1)
        {
            if(v[0].second=='L')
            {
                ans+='L';
                val=v[0].first;
                l++;
            }
            else
            {
                ans+='R';
                val=v[0].first;
                r--;
            }

        }
        else
            break;

     }

     cout<<ans.size()<<"\n"<<ans<<"\n";

     return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
//#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    long long n, ans = 0;
    vector<char> an;
    cin >> n;

    vector<long long> a(n);

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l = -1;

    while (i != j) {
        if (a[i] < a[j] && a[i] > l) {
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        else if (a[j] > l) {
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else {
            break;
        }
    }

    if (a[i] > l) {
        an.push_back('L');
        ans++;
    }
    else if (a[j] > l) {
        an.push_back('R');
        ans++;
    }

    cout << an.size() << endl;

    fi(i, 0, an.size()) {
        cout << an[i];
    }

    return 0;

}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
//#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    int n, ans = 0;
    vector<char> an;
    cin >> n;

    vector<int> a(n);

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l = -1;

    while (i != j) {
        if (a[i] < a[j] && a[i] > l) {
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        else if (a[j] > l) {
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else {
            break;
        }
    }

    if (a[i] > l && a[i] > l) {
        an.push_back('L');
        ans++;
    }
    else if (a[j] > l && a[j] > l) {
        an.push_back('R');
        ans++;
    }

    cout << ans << endl;

    fi(i, 0, n - 1) {
        cout << an[i];
    }

    return 0;

}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    int n, ans = 0;
    string an;
    cin >> n;

    vector<int> a(n);
    vector<int> b;

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l;
    char last;

    while (i != j) {
        if (a[i] < a[j] && a[i] > l) {
            b.push_back(a[i]);
            l = a[i];
            an.push_back('L');
            ans++;
            last = 'L';
            i++;
        }
        else if (a[j] > l) {
            b.push_back(a[j]);
            an.push_back('R');
            l = a[j];
            ans++;
            last = 'R';
            j--;
        }
        else {
            break;
        }
    }

    if (a[i] > b[b.size() - 1] && a[i] > l) {
        an.push_back(last);
        ans++;
    }
    else if (a[j] > b[b.size() - 1] && a[j] > l) {
        an.push_back(last);
        ans++;
    }

    cout << ans << endl;

    cout << an << endl;

    return 0;

}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    int n, ans = 0;
    string an;
    cin >> n;

    vector<int> a(n);
    vector<int> b;

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l;
    char last;

    while (i != j) {
        if (a[i] < a[j] && a[i] > l) {
            b.push_back(a[i]);
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        else if (a[j] > l) {
            b.push_back(a[j]);
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else {
            break;
        }
    }

    if (a[i] > b[b.size() - 1] && a[i] > l) {
        an.push_back('L');
        ans++;
    }
    else if (a[j] > b[b.size() - 1] && a[j] > l) {
        an.push_back('R');
        ans++;
    }

    cout << ans << endl;

    cout << an << endl;

    return 0;

}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
//#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    int n, ans = 0;
    vector<char> an;
    cin >> n;

    vector<int> a(n);

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l = -1;

    while (i <= j) {
        if (a[i] < a[j] && a[i] > l) {
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        if (a[i] > a[j] && a[j] > l) {
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else if (a[i] > l) {
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        else if (a[j] > l) {
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else {
            break;
        }
    }

//    if (a[i] > l) {
//        an.push_back('L');
//        ans++;
//    }
//    else if (a[j] > l) {
//        an.push_back('R');
//        ans++;
//    }

    cout << an.size() << endl;

    fi(i, 0, an.size()) {
        cout << an[i];
    }

    return 0;

}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
//#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    int n, ans = 0;
    vector<char> an;
    cin >> n;

    vector<int> a(n);

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l = -1;

    while (i != j) {
        if (a[i] < a[j] && a[i] > l) {
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        else if (a[j] > l) {
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else {
            break;
        }
    }

    if (a[i] > l) {
        an.push_back('L');
        ans++;
    }
    else if (a[j] > l) {
        an.push_back('R');
        ans++;
    }

    cout << ans << endl;

    fi(i, 0, an.size()) {
        cout << an[i];
    }

    return 0;

}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

//#define ll long long
//#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
//#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

int main()
{
    long long n, ans = 0;
    vector<char> an;
    cin >> n;

    vector<long long> a(n);

    fi(i, 0, n) {
        cin >> a[i];
    }

    int i = 0, j = n - 1, l = -1;

    while (i != j) {
        if (a[i] < a[j] && a[i] > l) {
            l = a[i];
            an.push_back('L');
            ans++;
            i++;
        }
        else if (a[j] > l) {
            an.push_back('R');
            l = a[j];
            ans++;
            j--;
        }
        else {
            break;
        }
    }

    if (a[i] > l) {
        an.push_back('L');
        ans++;
    }
    else if (a[j] > l) {
        an.push_back('R');
        ans++;
    }

    cout << ans << endl;

    fi(i, 0, an.size()) {
        cout << an[i];
    }

    return 0;

}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   while(l<=r) {
      while(a[l]<=cur_mx && l<=r)
         l++;
      while(a[r]<=cur_mx && l<=r)
         r--;
      if (l>r)
         break;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
      if (l>=r)
         break;
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   while(l<=r) {
      while(a[l]<=cur_mx && l<=r)
         l++;
      while(a[r]<=cur_mx && l<=r)
         r--;
      if (l>r)
         break;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   while(l<=r) {
      while(a[l]<cur_mx && l<=r)
         l++;
      while(a[r]<cur_mx && l<=r)
         r--;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   while(l<=r) {
      while(a[l]<cur_mx && l<=r)
         l++;
      while(a[r]<cur_mx && l<=r)
         r--;
      if (l>r)
         break;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   bool vis = false;
   while(l<r) {
      while(a[l]<=cur_mx && l<=r)
         l++;
      while(a[r]<=cur_mx && l<=r)
         r--;
      if (l>r)
         break;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
   }
   if (l==r)
      out+="R";
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   while(l<=r) {
      while(a[l]<cur_mx && l<r)
         l++;
      while(a[r]<cur_mx && l<r)
         r--;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   bool vis = false;
   while(l<=r) {
      while(a[l]<=cur_mx && l<=r)
         l++;
      while(a[r]<=cur_mx && l<=r)
         r--;
      if (l>r)
         break;
      cur_mx = min(a[l], a[r]);
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
      if (vis)
         break;
      if (l==r) {
         vis = true;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   while(l<=r) {
      while(a[l]<cur_mx && l<r)
         l++;
      while(a[r]<cur_mx && l<r)
         r--;
      cur_mx = min(a[l], a[r]);
      if (a[l]==cur_mx) {
         out+="L";
         l++;
      }
      else {
         out+="R";
         r--;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define MAXN 200005

int main () {
   int N;
   cin >> N;
   int a[MAXN];
   for(int i=0; i<N; i++)
      cin >> a[i];
   int l = 0, r = N-1;
   string out = "";
   int cur_mx = -1;
   bool vis = false;
   while(l<=r) {
      if (a[l]<cur_mx && a[r]<cur_mx)
         break;
      int temp = MAXN;
      if (a[l]>cur_mx)
         temp = min(temp, a[l]);
      if (a[r]>cur_mx)
         temp = min(temp, a[r]);
      cur_mx = temp;
      if (a[r]==cur_mx) {
         out+="R";
         r--;
      }
      else {
         out+="L";
         l++;
      }
   }
   cout << out.size() << endl;
   cout << out << endl;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
#define mod 1000000007

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int L=0,R=n-1;
    int pre=0;
    string str;
    while(L<=R)
    {
        //cout<<"ndlnfldnfn\n";
        //cout<<pre<<" "<<a[L]<<" "<<a[R]<<endl;
        if(L==R&&a[L]>pre)
        {
            str=str+"L";
            L++;
            break;
        }
        if(a[L]>pre||a[R]>pre)
        {
            if(a[L]>pre&&a[R]>pre)
            {
                if(a[L]<a[R]){
                        pre=a[L];
                str=str+"L";
                L++;
                }
                else
                {
                    pre=a[R];
                    str=str+"R";
                    R--;
                }
            }
            else if(a[L]>pre)
            {
                pre=a[L];
                str=str+"L";
                L++;
            }
            else
            {
                pre=a[R];
                R--;
                //pre=a[R];
                str=str+"R";
            }
        }
        else
        {
            break;
        }
    }
    cout<<str.length()<<endl<<str;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int L=0,R=n-1;
    int pre=0;
    vector<char> str;
    vector<char> l,r;
    while(L<=R)
    {
        //cout<<"ndlnfldnfn\n";
        //cout<<pre<<" "<<a[L]<<" "<<a[R]<<endl;
        if(L==R&&a[L]>pre)
        {
            a[L]=-1;
            str.push_back('L');
            L++;
            break;
        }
        if(a[L]>pre||a[R]>pre)
        {
            if(a[L]==a[R])
            {

                int p2=pre;
                for(int i=L;i<n;i++)
                {
                    if(a[i]==-1)break;
                    if(a[i]>pre)
                    {
                        l.push_back('L');
                        pre=a[i];
                    }
                    else break;
                }
                pre=p2;

                for(int i=R;i>=0;i--)
                {
                    if(a[i]==-1)break;
                    if(a[i]>pre)
                    {
                        r.push_back('R');
                        pre=a[i];
                    }
                    else break;
                }
                break;
            }
            if(a[L]>pre&&a[R]>pre)
            {
                if(a[L]<a[R]){
                        pre=a[L];
                        a[L]=-1;
                str.push_back('L');
                L++;
                }
                else
                {
                    pre=a[R];
                    str.push_back('R');
                    a[R]=-1;
                    R--;

                }
            }
            else if(a[L]>pre)
            {
                pre=a[L];
                str.push_back('L');
                a[L]=-1;
                L++;
            }
            else
            {
                pre=a[R];
                a[R]=-1;
                R--;
                //pre=a[R];
                str.push_back('R');
            }
        }
        else
        {
            break;
        }
    }
    int k;
    if(l.size()>r.size())k=l.size();
    else k=r.size();
    cout<<str.size()+k<<endl;
    for(int i=0;i<str.size();i++)cout<<str[i];
    if(l.size()>r.size())
    {
        for(int i=0;i<l.size();i++)cout<<l[i];
    }
    else for(int i=0;i<r.size();i++)cout<<r[i];
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
#define mod 1000000007

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int L=0,R=n-1;
    int pre=0;
    while(L<=R)
    {
        //cout<<"ndlnfldnfn\n";
        //cout<<pre<<" "<<a[L]<<" "<<a[R]<<endl;
        if(L==R&&a[L]>pre)
        {
            cout<<"L";
            L++;
            break;
        }
        if(a[L]>pre||a[R]>pre)
        {
            if(a[L]>pre&&a[R]>pre)
            {
                if(a[L]<a[R]){
                        pre=a[L];
                cout<<"L";
                L++;
                }
                else
                {
                    pre=a[R];
                    cout<<"R";
                    R--;
                }
            }
            else if(a[L]>pre)
            {
                pre=a[L];
                cout<<"L";
                L++;
            }
            else
            {
                pre=a[R];
                R--;
                //pre=a[R];
                cout<<"R";
            }
        }
        else
        {
            break;
        }
    }
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int L=0,R=n-1;
    int pre=0;
    string str;
    while(L<=R)
    {
        //cout<<"ndlnfldnfn\n";
        //cout<<pre<<" "<<a[L]<<" "<<a[R]<<endl;
        if(L==R&&a[L]>pre)
        {
            str=str+"L";
            L++;
            break;
        }
        if(a[L]>pre||a[R]>pre)
        {
            if(a[L]>pre&&a[R]>pre)
            {
                if(a[L]<a[R]){
                        pre=a[L];
                str=str+"L";
                L++;
                }
                else
                {
                    pre=a[R];
                    str=str+"R";
                    R--;
                }
            }
            else if(a[L]>pre)
            {
                pre=a[L];
                str=str+"L";
                L++;
            }
            else
            {
                pre=a[R];
                R--;
                //pre=a[R];
                str=str+"R";
            }
        }
        else
        {
            break;
        }
    }
    cout<<str.length()<<endl<<str;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int l=0,r=n-1;
    int count=0;
    vector<char> ans;
    int pre=0;
    while(l<=r)
    {
        //cout<<l<<" "<<r<<" "<<pre<<'\n';
        if(a[l]>pre&&a[r]>pre)
        {
            count++;
            if(a[l]<a[r])
            {
                pre=a[l];
                ans.push_back('L');
                l++;
            }
            else
            {
                pre=a[r];
                ans.push_back('R');
                r--;
            }
        }
        else if(a[l]>pre)
        {
            count++;
            ans.push_back('L');
            pre=a[l];
            l++;
        }
        else if(a[r]>pre)
        {
            count++;
             ans.push_back('R');
             pre=a[r];
            r--;

        }
        else break;
    }
    cout<<count<<endl;
    for(int i=0;i<count;i++)cout<<ans[i];
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
#define mod 1000000007

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int L=0,R=n-1;
    int pre=0;
    string str;
    while(L<=R)
    {
        //cout<<"ndlnfldnfn\n";
        //cout<<pre<<" "<<a[L]<<" "<<a[R]<<endl;
        if(L==R&&a[L]>pre)
        {
            str=str+"L";
            L++;
            break;
        }
        if(a[L]>pre||a[R]>pre)
        {
            if(a[L]>pre&&a[R]>pre)
            {
                if(a[L]<a[R]){
                        pre=a[L];
                str=str+"L";
                L++;
                }
                else
                {
                    pre=a[R];
                    str=str+"R";
                    R--;
                }
            }
            else if(a[L]>pre)
            {
                pre=a[L];
                str=str+"L";
                L++;
            }
            else
            {
                pre=a[R];
                R--;
                //pre=a[R];
                str=str+"R";
            }
        }
        else
        {
            break;
        }
    }
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
#define mod 1000000007

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int L=0,R=n-1;
    int pre=0;
    vector<char> str;
    while(L<=R)
    {
        //cout<<"ndlnfldnfn\n";
        //cout<<pre<<" "<<a[L]<<" "<<a[R]<<endl;
        if(L==R&&a[L]>pre)
        {
            str.push_back('L');
            L++;
            break;
        }
        if(a[L]>pre||a[R]>pre)
        {
            if(a[L]>pre&&a[R]>pre)
            {
                if(a[L]<a[R]){
                        pre=a[L];
                str.push_back('L');
                L++;
                }
                else
                {
                    pre=a[R];
                    str.push_back('R');
                    R--;
                }
            }
            else if(a[L]>pre)
            {
                pre=a[L];
                str.push_back('L');
                L++;
            }
            else
            {
                pre=a[R];
                R--;
                //pre=a[R];
                str.push_back('R');
            }
        }
        else
        {
            break;
        }
    }
    cout<<str.size()<<endl;
    for(int i=0;i<str.size();i++)cout<<str[i];
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define INF 99999999
int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int l=0,r=n-1;
    int count=0;
    vector<char> ans;
    int pre=0;
    while(l<=r)
    {
        cout<<l<<" "<<r<<" "<<pre<<'\n';
        if(a[l]>pre&&a[r]>pre)
        {
            count++;
            if(a[l]<a[r])
            {
                pre=a[l];
                ans.push_back('L');
                l++;
            }
            else
            {
                pre=a[r];
                ans.push_back('R');
                r--;
            }
        }
        else if(a[l]>pre)
        {
            count++;
            ans.push_back('L');
            pre=a[l];
            l++;
        }
        else if(a[r]>pre)
        {
            count++;
             ans.push_back('R');
             pre=a[r];
            r--;

        }
        else break;
    }
    cout<<count<<endl;
    for(int i=0;i<count;i++)cout<<ans[i];
}


#pragma GCC optimize(2)
#pragma comment(linker,"/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
#include<queue>
#include<stack>
using namespace std;
#define ll long long
#define MAXN 1000005
inline ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

ll a[2000005];

int main()
{

    ll n;
    cin>>n;
    ll i,j;
    for(i=0;i<n;i++) cin>>a[i];
    ll ans=0;
    string sans;
    ll last=-1;
    ll p=0,q=n-1;
    while(ans<n&&p<=q&&p<n&&q>=0)
    {
        int check=0;
        if(a[p]>last&&a[q]>last)
        {
         if(a[p]<=a[q])
        {
            sans[ans]='L';
            ans++;
            last=a[p];
            p++;
            check=1;
            continue;
        }
        else
        {
            sans[ans]='R';
            ans++;
            last=a[q];
            q--;
            check=1;
            continue;
        }
        }
        else
        {
          if(a[p]>last)
        {
            sans[ans]='L';
            ans++;
            last=a[p];
            p++;
            check=1;
            continue;
        }
          if(a[q]>last)
        {
            sans[ans]='R';
            ans++;
            last=a[q];
            q--;
            check=1;
            continue;
        }
        }
        if(!check) break;
    }
    printf("%lld\n",ans);
    //sans[ans]='\0';
    for(i=0;i<ans;i++) cout<<sans[i];

}


#pragma GCC optimize(2)
#pragma comment(linker,"/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
#include<queue>
#include<stack>
using namespace std;
#define ll long long
#define MAXN 1000005
inline ll read()
{
    ll x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

ll a[200005];

int main()
{

    ll n;
    n=read();
    ll i,j;
    for(i=0;i<n;i++) a[i]=read();
    ll ans=0;
    string sans;
    ll last=-1;
    ll p=0,q=n-1;
    while(ans<n)
    {
        int check=0;
        if(a[p]>last&&a[q]>last)
        {
         if(a[p]<a[q])
        {
            sans[ans]='L';
            ans++;
            last=a[p];
            p++;
            check=1;
        }
        else
        {
            sans[ans]='R';
            ans++;
            last=a[q];
            q--;
            check=1;
        }
        }
        else
        {
          if(a[p]>last)
        {
            sans[ans]='L';
            ans++;
            last=a[p];
            p++;
            check=1;
        }
          if(a[q]>last)
        {
            sans[ans]='R';
            ans++;
            last=a[q];
            q--;
            check=1;
        }
        }
        if(!check) break;
    }
    printf("%lld\n",ans);
    sans[ans]='\0';
    for(i=0;i<ans;i++) cout<<sans[i];

}


#include<iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int x,n,m;
		cin>>x>>n>>m;
		while(x>=20&&n>0){
			n--;
			x=x/2+10;
		}
		while(x>0&&m>0){
			m--;
			x=x-10;
		}
		if(x<=0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}


#include <iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int h,v,l;
		cin>>h>>v>>l;
		while((((h/2)+10)<=h)&&(v!=0)){
			h/=2;
			h+=10;
			v--;
		}if((l*10)>=h){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
}


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

int t,x,n,m;
int main(){
	cin>>t;
	while(t--){
		cin>>x>>n>>m;
		while(x>20&&n>0){
			n--;
			x=x/2+10;
		}
		while(m--){
			x-=10;
		}
		if(x>0)cout<<"NO"<<endl;
		else{cout<<"YES"<<endl;}
	}
	return 0;
}


#include<iostream>
using namespace std;
int t,x,m,n;
int main(){
	cin >> t;
	while(t--){
		x=0;
		m=0;
		n=0;
		cin >> x >> m >> n;
		while(x>=20&&m--){
			x=x/2+10;
		}
		while(x>0&&n--){
			x-=10;
		}
		if(x<=10)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int T;
int x,n,m;
int main()
{
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d",&x,&n,&m);
		for (int i=1;i<=n;i++)
			if (((x/2)+10)<x)
				x=((x/2)+10);
		x-=m*10;
		if (x<=0)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int hp,l,v,s;
int main(){
    cin>>hp;
    for(int i=1;i<=hp;i++){
        cin>>l>>v>>s;
        while(l>20&&v>0){
            l=(l>>1)+10;
            --v;
        }if(l<=s*10)puts("YES");
        else puts("NO");
    }return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int x,n,m;
		cin>>x>>n>>m;
		while(n>0){
			if(x<=20) break;
			x=x/2+10,n--;
		}
		while(m>0){
			if(x<=0) break;
			x-=10,m--;
		}
		if(x<=0) cout<<"YES";
		else cout<<"NO";
		cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int x,n,m;
		scanf("%d%d%d",&x,&n,&m);
		for(int i=0;i<n;i++)
		{
			if(x<=20)break;
			x=x/2+10;
		}
		if(x>10*m)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
}


#include <cstdio>

int T, x, n, m;

void input_calc_output()
{
	// input
	scanf("%d", &T);
	for (int i = 1; i <= T; i++)
	{
		scanf("%d %d %d", &x, &n, &m);
		// calc
		while ((x/2+10)<=x && (n!=0))
		{
			x = x/2+10;
			n--;
		}

		// output
		if (m*10 >= x)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

int main()
{
	input_calc_output();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int T;
	cin>>T;
	int x,n,m;
	for(int i=1;i<=T;i++)
	{
		cin>>x>>n>>m;
		while(n&&x>20)
		{
			x=x/2+10;
			n--;
		}
		if(x<=m*10) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int T;
	cin>>T;
	for(int i=0;i<T;i++){
		int x,m,n;
		cin>>x>>n>>m;
		while(x>=20&&n!=0){
			x=x/2+10;
			n--;
		}
		while(x>0 &&m!=0){
			x=x-10;
			m--;
		}
		if(x>0) cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
}


#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int x,n,m;
		cin >> x >> n >> m;
		while (x >= 20 && n--)
			x = x / 2 + 10;
		while (x > 0 && m--)
			x -= 10;
		if (x > 0)
			cout << "NO" << endl;
		else
			cout << "YES" << endl;
	}
    return 0;
}


#include<cstdio>
using namespace std;
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int flag=0;
		int x,n,m;
		scanf("%d%d%d",&x,&n,&m);
		while(n--)
		{
			if(x-x/2<=10)break;
			x=x/2+10;
			if(x<=0)
			{
				printf("YES\n");
				flag=1;
				break;
			}
		}
		while(m--)
		{
			x=x-10;
			if(x<=0)
			{
				printf("YES\n");
				flag=1;
				break;
			}
		}
		if(flag==0)
		{
			printf("NO\n");
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sc_int static_cast<int>
int main()
{
	int t;
	cin >> t;
	ll x, n, m;
	while(t--)
	{
		cin >> x >> n >> m;
		if(x > 20)
		{
			for(int i = 0; i < n; i++) x = x/2 + 10;
			if(x - 10*m <= 0) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(m > 1) cout << "YES" << endl;
		else if(x <= 10 && m == 1) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sc_int static_cast<int>
int main()
{
	int t;
	cin >> t;
	ll x, n, m;
	while(t--)
	{
		cin >> x >> n >> m;
		if(x >= 20)
		{
			for(int i = 0; i < n; i++) x = x/2 + 10;
			if(x - 10*m <= 0) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(m != 1) cout << "YES";
		else if(x <= 10) cout << "YES";
		else cout << "NO";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sc_int static_cast<int>
int main()
{
	int t;
	cin >> t;
	ll x, n, m;
	while(t--)
	{
		cin >> x >> n >> m;
		if(x >= 20)
		{
			for(int i = 0; i < n; i++) x = x/2 + 10;
			if(x - 10*m <= 0) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(m != 1) cout << "YES" << endl;
		else if(x <= 10) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sc_int static_cast<int>
int main()
{
	int t;
	cin >> t;
	ll x, n, m;
	while(t--)
	{
		cin >> x >> n >> m;
		if(x >= 20)
		{
			for(int i = 0; i < n; i++) x = x/2 + 10;
			if(x - 10*m <= 0) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(m > 1) cout << "YES" << endl;
		else if(x <= 10 || m == 1) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int h,x,y;
cin>>h>>x>>y;
while(h>21 && x>0)
{
h=(h/2)+10;
x--;
}
if(y*10-h>=0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int h,x,y;
cin>>h>>x>>y;
while(h>20 && x>0)
{
h=(h/2)+10;
cout<<h<<endl;
x--;
}
//cout<<h<<endl;
if(y*10-h>=0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int h,x,y;
cin>>h>>x>>y;
while(h>20 && x>0)
h=(h/2)+10;
if(y*10-h>=0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int h,x,y;
cin>>h>>x>>y;
while(h>20 && x>0)
{
h=(h/2)+10;
//cout<<h<<endl;
x--;
}
//cout<<h<<endl;
if(y*10-h>=0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int64_t long long
constexpr int64_t MOD=1e9+7;

int a[100100][31][32];
int main() {
    //ios_base::sync_with_stdio(0);
    int tc;scanf("%d",&tc);while(tc--){
        int x,n,m;
        scanf("%d%d%d",&x,&n,&m);
        for(int i=0;i<=x;++i){
            for(int j=0;j<=n;++j){
                for(int k=0;k<=m;++k){
                    a[i][j][k]=0;
                    if(i==0){
                        a[i][j][k]=1;
                    }else{
                        if(j>0&&i/2+10<i){
                            a[i][j][k]|=a[i/2+10][j-1][k];
                        }
                        if(k>0){
                            a[i][j][k]|=a[max(i-10,0)][j][k-1];
                        }
                    }
                }
            }
        }
        if(a[x][n][m])printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int64_t long long
constexpr int64_t MOD=1e9+7;

int a[100001][31][31];
int main() {
    //ios_base::sync_with_stdio(0);
    int tc;scanf("%d",&tc);while(tc--){
        int x,n,m;
        scanf("%d%d%d",&x,&n,&m);
        for(int i=0;i<=x;++i){
            for(int j=0;j<=n;++j){
                for(int k=0;k<=m;++k){
                    a[i][j][k]=0;
                    if(i==0){
                        a[i][j][k]=1;
                    }else{
                        if(j>0&&i/2+10<i){
                            a[i][j][k]|=a[i/2+10][j-1][k];
                        }
                        if(k>0){
                            a[i][j][k]|=a[max(i-10,0)][j][k-1];
                        }
                    }
                }
            }
        }
        if(a[x][n][m])printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int64_t long long
constexpr int64_t MOD=1e9+7;

bool f(int x,int n,int m) {
    if(x<=0)return 1;
    bool ret = 0;
    if(n>0) ret |=f(x/2+10,n-1,m);
    if(m>0) ret |=f(x-10,n,m-1);
    return ret;
}

int main() {
    //ios_base::sync_with_stdio(0);
    int tc;scanf("%d",&tc);while(tc--){
        int x,n,m;
        scanf("%d%d%d",&x,&n,&m);
        if(f(x,n,m))printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int64_t long long
constexpr int64_t MOD=1e9+7;

bool f(int x,int n,int m) {
    if(x<=0)return 1;
    if(x>m*10){
        if(n>0)return f(x/2+10,n-1,m);
        else return 0;
    }
    return 1;
}

int main() {
    //ios_base::sync_with_stdio(0);
    int tc;scanf("%d",&tc);while(tc--){
        int x,n,m;
        scanf("%d%d%d",&x,&n,&m);
        if(f(x,n,m))printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int64_t long long
constexpr int64_t MOD=1e9+7;

bool a[100001][31][31];
int main() {
    //ios_base::sync_with_stdio(0);
    int tc;scanf("%d",&tc);while(tc--){
        int x,n,m;
        scanf("%d%d%d",&x,&n,&m);
        for(int i=0;i<=x;++i){
            for(int j=0;j<=n;++j){
                for(int k=0;k<=m;++k){
                    a[i][j][k]=0;
                    if(i==0){
                        a[i][j][k]=1;
                    }else{
                        if(j>0&&i/2+10<i){
                            a[i][j][k]|=a[i/2+10][j-1][k];
                        }
                        if(k>0){
                            a[i][j][k]|=a[max(i-10,0)][j][k-1];
                        }
                    }
                }
            }
        }
        if(a[x][n][m])printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  cin >> T;
  while (T--) {
    cin >> x >> n >> m;
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  cin >> T;
  while (T--) {
    cin >> x >> n >> m;
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  cin >> T;
  while (T--) {
    cin >> x >> n >> m;
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  cin >> T;
  while (T--) {
    cin >> x >> n >> m;
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
return 0;
}


#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  cin >> T;
  while (T--) {
    cin >> x >> n >> m;
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}


#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  scanf("%d",&T);
  while (T--) {
    scanf("%d%d%d", &x, &n, &m);
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}


#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d", &x, &n, &m);
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      printf("NO\n");
    else
      printf("YES\n");
  }
}


#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int T, x, n, m;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d", &x, &n, &m);
    while (n-- && x > 10) x = floor(x / 2) + 10;
    x -= (m * 10);
    if (x > 0)
      printf("YES\n");
    else
      printf("NO\n");
  }
}


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

int main(){
    int t, x, n, m, i, j, k;
    cin>>t;
    for(i=0; i<t; i++){
        cin>>x>>n>>m;
        for(j=0; j<n; j++){
            x= (x/2) +10;
        }
        x= x- (m*10);
        if (x<=0) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


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

int main(){
    int t, x, n, m, i, j, k;
    cin>>t;
    for(i=0; i<t; i++){
        cin>>x>>n>>m;
        if(x>=20){
            for(j=0; j<n; j++){
                x= (x/2) +10;
            }
            x= x- (m*10);
        }
        else {
            x= x- (m*10);
        }
        if (x<=0) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


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

int main(){
    int t, x, n, m, i, j, k;
    cin>>t;
    for(i=0; i<t; i++){
        cin>>x>>n>>m;
        if(x>21){
            for(j=0; j<n; j++){
                x= (x/2) +10;
            }
            x= x- (m*10);
        }
        else {
            x= x- (m*10);
        }
        if (x<=0) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


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

int main(){
    int t, x, n, m, i, j, k;
    cin>>t;
    for(i=0; i<t; i++){
        cin>>x>>n>>m;
        if(x>19){
            for(j=0; j<n; j++){
                x= (x/2) +10;
            }
            x= x- (m*10);
        }
        else {
            x= x- (m*10);
        }
        if (x<=0) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=n=m=0;
        hp=read();
        n=read();
        m=read();
        if(m==0){
            cout<<"NO\n";continue;
        }
        if(n==0){
            if(hp<=10)cout<<"YES\n";
            else cout<<"NO\n";
            continue;
        }
        if(hp-m*10<=0){
            cout<<"YES\n";
            continue;
        }
        while(hp>=20&&n>0){
            hp=hp/2+10;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=read();
        n=read();
        m=read();
        if(m==0){
            cout<<"NO\n";continue;
        }
        if(n==0){
            if(hp<=10)cout<<"YES\n";
            else cout<<"NO\n";
            continue;
        }
        if(hp-m*10<=0){
            cout<<"YES\n";
            continue;
        }
        while(hp>20&&n>0){
            hp=hp/2+10;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=n=m=0;
        hp=read();
        n=read();
        m=read();
        if(m==0){
            cout<<"NO\n";continue;
        }
        if(n==0){
            if(hp<=10*m)cout<<"YES\n";
            else cout<<"NO\n";
            continue;
        }
        if(hp-m*10<=0){
            cout<<"YES\n";
            continue;
        }
        while(hp>=20&&n>0){
            hp=hp/2+10;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    int res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n, m, hp;
int main()
{
    int t = read();
    while (t--)
    {
        cin >> hp >> n >> m;
        if (m == 0)
        {
            cout << "NO\n";
            continue;
        }
        if (n == 0)
        {
            if (hp <= 10 && m)
                cout << "YES\n";
            else
                cout << "NO\n";
            continue;
        }
        if (hp - m * 10 <= 0)
        {
            cout << "YES\n";
            continue;
        }
        int las = hp;
        while (n > 0)
        {
            hp = hp / 2 + 10;
            if(hp>las){hp=las;break;}
            las = hp;
            n--;
        }
        if (hp - m * 10 <= 0)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=read();
        n=read();
        m=read();
        if(m==0){
            cout<<"NO\n";continue;
        }
        if(n==0){
            if(hp<=10&&m)cout<<"YES\n";
            else cout<<"NO\n";
            continue;
        }
        if(hp-m*10<=0){
            cout<<"YES\n";
            continue;
        }
        while(hp>20&&n>0){
            if(hp%2==0)hp=hp/2+10;
            else hp = hp/2+11;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    int res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n, m, hp;
int main()
{
    int t = read();
    while (t--)
    {
        cin >> hp >> n >> m;
        if (m == 0)
        {
            cout << "NO\n";
            continue;
        }
        if (n == 0)
        {
            if (hp <= 10 && m)
                cout << "YES\n";
            else
                cout << "NO\n";
            continue;
        }
        if (hp - m * 10 <= 0)
        {
            cout << "YES\n";
            continue;
        }
        while (hp > 20 && n > 0)
        {
            hp = hp / 2 + 10;
            n--;
        }
        if (hp - m * 10 <= 0)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    int res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n, m, hp;
int main()
{
    int t = read();
    while (t--)
    {
        cin >> hp >> n >> m;
        if (m == 0)
        {
            cout << "NO\n";
            continue;
        }
        if (n == 0)
        {
            if (hp <= 10 && m)
                cout << "YES\n";
            else
                cout << "NO\n";
            continue;
        }
        if (hp - m * 10 <= 0)
        {
            cout << "YES\n";
            continue;
        }
        int f = 0;
        while(m>0){
            if(n==0){
                if(hp-m*10<=0)f=1;
                break;
            }
            if(hp<=0){f=1;break;}
            if(hp>20){
                n--;
                hp=hp/2+10;
            }
            else{
                m--;
                hp-=10;
                if(hp<=0){f=1;break;}
            }

        }
        if(hp<=0){cout<<"YES\n";continue;}
        if(f==1){cout<<"YES\n";}
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    int res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n, m, hp;
int main()
{
    int t = read();
    while (t--)
    {
        cin >> hp >> n >> m;
        if (m == 0)
        {
            cout << "NO\n";
            continue;
        }
        if (n == 0)
        {
            if (hp <= 10 && m)
                cout << "YES\n";
            else
                cout << "NO\n";
            continue;
        }
        if (hp - m * 10 <= 0)
        {
            cout << "YES\n";
            continue;
        }
        int f = 0;
        while(m>0){
            if(n==0){
                if(hp-m*10<=0)f=1;
                break;
            }
            if(hp<=0){f=1;break;}
            if(hp/2+10<=hp-10){
                n--;
                hp=hp/2+10;
            }
            if(hp/2+10>hp-10){
                m--;
                hp-=10;
                if(hp<=0){f=1;break;}
            }
        }
        if(hp<=0){cout<<"YES\n";continue;}
        if(f==1){cout<<"YES\n";}
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=read();
        n=read();
        m=read();
        if(m==0){
            cout<<"NO\n";continue;
        }
        if(n==0){
            if(hp<=10)cout<<"YES\n";
            else cout<<"NO\n";
            continue;
        }
        if(hp-m*10<=0){
            cout<<"YES\n";
            continue;
        }
        while(hp>=20&&n>0){
            hp=hp/2+10;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=n=m=0;
        hp=read();
        n=read();
        m=read();
        while(hp>=20&&n>0){
            hp=hp/2+10;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read()
{
    ll res = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        res = res * 10 + ch - 48, ch = getchar();
    return res;
}
int n,m,hp;
int main()
{
    int t = read();
    while (t--)
    {
        hp=read();
        n=read();
        m=read();
        if(m==0){
            cout<<"NO\n";continue;
        }
        if(n==0){
            if(hp<=10&&m)cout<<"YES\n";
            else cout<<"NO\n";
            continue;
        }
        if(hp-m*10<=0){
            cout<<"YES\n";
            continue;
        }
        while(hp>20&&n>0){
            hp=hp/2+10;
            n--;
        }
        if(hp-m*10<=0)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int t;
   cin>>t;
   while(t--)
   {    int flag=0;

       int h,m,n;
       cin>>h>>m>>n;
       while(h>0)
       {
           if(h>20 && m>0)
           {h=floor(h/2)+10;
           m--;}

            if((h<=20 && n>0 ) || (m==0 && n>0))
           {
            h=h-10;
            n--;}

           if(m==0&&n==0&&h>0)
           {flag=1;
           break;}

        }

        if(flag==1)
        cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

   }

   return 0;
}


#include <stdio.h>
#include<math.h>

int main()
{
   int t;
   scanf("%d",&t);
   while(t--)
   {    int flag=0;

       int h,m,n;
       scanf("%d %d %d",&h,&m,&n);

       while(h>20 && m>0 && (h-(n*10)))
       {

           h=floor(h/2)+10;
           m--;

       }

          if((h-(n*10))>0)

          printf("NO\n");

           else printf("YES\n");

   }

   return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
   int t;
   scanf("%d",&t);
   while(t--)
   {    int flag=0;

       int h,m,n;
       scanf("%d %d %d",&h,&m,&n);
       while(h>0)
       {
           if(h>20 && m>0)
           {h=floor(h/2)+10;
           m--;}

            if((h<=20 && n>0 ) || (m==0 && n>0))
           {
            h=h-10;
            n--;}

           if(m==0&&n==0&&h>0)
           {flag=1;
           break;}

        }

        if(flag==1)
        printf("NO\n");
        else printf("YES\n");

   }

   return 0;
}


#include <stdio.h>
#include<math.h>

int main()
{
   int t;
   scanf("%d",&t);
   while(t--)
   {    int flag=0;

       int h,m,n;
       scanf("%d %d %d",&h,&m,&n);

       while(h>0 && m>0 && (h-(n*10)))
       {

           h=floor(h/2)+10;
           m--;

       }

          if((h-(n*10))>0)
          printf("NO\n");
           else printf("YES\n");

   }

   return 0;
}


#include "iostream"
#include "algorithm"
#include "string.h"
#include "stdio.h"
#include "vector"
#include "queue"
#include "map"
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while (t--){
		int x;
		int a,b;
	   scanf("%d%d%d",&x,&a,&b);
	    while (1){
	    	if ((x/2+10 <= x) && a > 0){
	    		x = x/2+10;
	    		a--;
	    	}
	    	else {
	    		if (b > 0){
	    		x = x - 10;
	    		b--;
	    		}

	    	}
	    	if ((a == 0 && b == 0)|| x <= 0)break;
	    }
	    if (x > 0)printf("NO\n");
	    else printf("YES\n");
	}
	return 0;
}


#include "iostream"
#include "algorithm"
#include "string.h"
#include "stdio.h"
#include "vector"
#include "queue"
#include "map"
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while (t--){
		int x;
		int a,b;
	    cin >> x >> a >> b;
	    while (1){
	    	if ((x/2+10 < x) && a > 0){
	    		x = x/2+10;
	    		a--;
	    	}
	    	else {
	    		if (b > 0){
	    		x = x - 10;
	    		b--;
	    		}

	    	}
	    	if ((a == 0 && b == 0)|| x <= 0)break;
	    }
	    if (x > 0)cout << "NO" <<endl;
	    else cout << "YES"<<endl;
	}
	return 0;
}


#include "iostream"
#include "algorithm"
#include "string.h"
#include "stdio.h"
#include "vector"
#include "queue"
#include "map"
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while (t--){
		int x;
		int a,b;
	    cin >> x >> a >> b;
	    while (1){
	    	if ((x/2+10 <= x) && a > 0){
	    		x = x/2+10;
	    		a--;
	    	}
	    	else {
	    		if (b > 0){
	    		x = x - 10;
	    		b--;
	    		}

	    	}
	    	if ((a == 0 && b == 0)|| x <= 0)break;
	    }
	    if (x > 0)cout << "NO" <<endl;
	    else cout << "YES"<<endl;
	}
	return 0;
}


#include "iostream"
#include "algorithm"
#include "string.h"
#include "stdio.h"
#include "vector"
#include "queue"
#include "map"
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while (t--){
		int x;
		int a,b;
	   scanf("%d%d%d",&x,&a,&b);
	   for (int i = 1; i <= a ;i++){
	   	  if ((x/2 +10) > x)break;
	   	  x = x/2 + 10;
	   }
	    x = x - b * 10;
	    if (x > 0)printf("NO\n");
	    else printf("YES\n");
		}
	return 0;
}


#include "iostream"
#include "algorithm"
#include "string.h"
#include "stdio.h"
#include "vector"
#include "queue"
#include "map"
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while (t--){
		int x;
		int a,b;
	   scanf("%d%d%d",&x,&a,&b);
	    while (1){
	    	if ((x/2+10 <= x) && a > 0){
	    		x = x/2+10;
	    		a--;
	    	}
	    	else {
	    		if (b > 0){
	    		x = x - 10;
	    		b--;
	    		}

	    	}
	    	if ((a == 0 && b == 0)|| x <= 0)break;
	    }
	    if (x > 0)printf("NO\n");
	    printf("YES\n");
	}
	return 0;
}


#include "iostream"
#include "algorithm"
#include "string.h"
#include "stdio.h"
#include "vector"
#include "queue"
#include "map"
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while (t--){
		int x;
		int a,b;
	   scanf("%d%d%d",&x,&a,&b);
	    while (1){
	    	if ((x/2+10 <= x) && a > 0){
	    		x = x/2+10;
	    		a--;
	    	}
	    	else {
	    		x = x - 10*b;
	    		b = 0;
	    		}
	    		if ((a == 0 && b == 0)|| x <= 0)break;
	    	}

	    if (x > 0)printf("NO\n");
	    else printf("YES\n");
		}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ab(int x)
{
	x=x/2+10;
	return x;
}
int st(int x)
{
	x=x-10;
	return x;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		bool flag = 0;
		int x,n,m;
		cin>>x>>n>>m;
		if(n==0)
		{
			cout<<(x<=10*m?"YES":"NO")<<"\n";
			continue;
		}
		else if(m==0)
		{
			cout<<"NO"<<endl;
			continue;
		}
		if(x<=20)
		{

			for(int i=1;i<=m;i++)
			{
				x=st(x);
				if(x<=0)
				{
					cout<<"YES"<<endl;
					break;
				}
				else if(i==m&&x>0)
				{
					cout<<"NO"<<endl;
				}
			}
		}
		else
		{
			for(int i=1;i<=n;i++)
			{
				x=ab(x);
				if(x<=20||i==n)
				{
					for(int j=1;j<=m;j++)
					{
						x=st(x);
						if(x<=0)
						{
							flag = 1;
							break;
						}
					}
					if(flag==1)
					{
						cout<<"YES"<<endl;
						break;
					}
					else
					{
						cout<<"NO"<<endl;
						break;
					}
				}
			}
		}
	}//
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ab(int x)
{
	x=x/2+10;
	return x;
}
int st(int x)
{
	x=x-10;
	return x;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		bool flag = 0;
		int x,n,m;
		cin>>x>>n>>m;
		if(n==0)
		{
			cout<<(x<=10*m?"YES":"NO")<<"\n";
			continue;
		}
		else if(m==0)
		{
			cout<<"NO"<<endl;
			continue;
		}
		if(x<=20)
		{

			for(int i=1;i<=m;i++)
			{
				x=st(x);
				if(x<=0)
				{
					cout<<"YES"<<endl;
					break;
				}
				else if(i==m&&x>0)
				{
					cout<<"NO"<<endl;
				}
			}
		}
		else
		{
			for(int i=1;i<=n;i++)
			{
				x=ab(x);
				if(x<=20||i==n)
				{
					for(int j=1;j<=m;j++)
					{
						x=st(x);
						if(x<=0)
						{
							flag = 1;
							break;
						}
					}
					if(flag==1)
					{
						cout<<"YES"<<endl;
						break;
					}
					else
					{
						cout<<"NO"<<endl;
						break;
					}
				}
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ab(int x)
{
	x=x/2+10;
	return x;
}
int st(int x)
{
	x=x-10;
	return x;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		bool flag = 0;
		int x,n,m;
		cin>>x>>n>>m;
		if(n==0)
		{
			cout<<(x<=10*m?"YES":"NO")<<"\n";
			continue;
		}
		/*else if(m==0)
		{
			cout<<"NO"<<endl;
			continue;
		}*/
		if(x<=20)
		{

			for(int i=1;i<=m;i++)
			{
				x=st(x);
				if(x<=0)
				{
					cout<<"YES"<<endl;
					break;
				}
				else if(i==m&&x>0)
				{
					cout<<"NO"<<endl;
				}
			}
		}
		else
		{
			for(int i=1;i<=n;i++)
			{
				x=ab(x);
				if(x<=20||i==n)
				{
					for(int j=1;j<=m;j++)
					{
						x=st(x);
						if(x<=0)
						{
							flag = 1;
							break;
						}
					}
					if(flag==1)
					{
						cout<<"YES"<<endl;
						break;
					}
					else
					{
						cout<<"NO"<<endl;
						break;
					}
				}
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ab(int x)
{
	x=x/2+10;
	return x;
}
int st(int x)
{
	x=x-10;
	return x;
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		bool flag = 0;
		int x,n,m;
		cin>>x>>n>>m;
		if(x<=20)
		{
			for(int i=1;i<=m;i++)
			{
				x=st(x);
				if(x<=0)
				{
					cout<<"YES"<<endl;
					break;
				}
				else if(i==m&&x>0)
				{
					cout<<"NO"<<endl;
				}
			}
		}
		else
		{
			for(int i=1;i<=n;i++)
			{
				x=ab(x);
				if(x<=20||i==n)
				{
					for(int j=1;j<=m;j++)
					{
						x=st(x);
						if(x<=0)
						{
							flag = 1;
							break;
						}
					}
					if(flag==1)
					{
						cout<<"YES"<<endl;
						break;
					}
					else
					{
						cout<<"NO"<<endl;
						break;
					}
				}
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t,x,n,m;
	scanf("%d",&t);
	while(t--)
	{
		x=0;
		n=0;
		m=0;
		scanf("%d%d%d",&x,&n,&m);
		while(x>=20&&n)
		{
			n--;
			x=x/2+10;
		}
		while(x>0&&m)
		{
			m--;
			x-=10;
		}
		if(x<=0)printf("YES");
		else printf("NO");
		printf("\n");
	}
	return 0;
}


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

int T,x,n,m;

int main(){
	scanf("%d",&T);
	while (T--)
	{
		scanf("%d%d%d",&x,&n,&m);
		while (x>=2*10 && n)
		{
			x=x/2+10; n--;
		}
		if (x<=m*10) puts("YES");
		else puts("NO");
	}
return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{

		bool q=true;
		int x,a,b;
		cin>>x>>a>>b;
		if(x<=b*10)					cout<<"YES"<<endl;
		else
		{
				for(int j=1;j<=a;j++)
		{

			x/=2;
			x+=10;
			if(x<=b*10)
				{
					cout<<"YES"<<endl;
					q=false;
					break;
				}
		}
		if(q==true)
			cout<<"NO"<<endl;
		}

	}
}