#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <fstream>
#include <sstream>
#include <algorithm>
using namespace std;

typedef pair <string, int> Pair;
typedef long long ll;

int main()
{
	//int u=65;
	//cout<<(char)u<<endl;
	//ifstream ff("file.txt");
	int n;
	cin>>n;
	vector <Pair> ip(n);
	int len;
	int  jk=0;
	for(int i=0; i<n; i++)
	{
		cin>>ip[i].first;
		jk=0;
		if(ip[i].first[0]=='R')
		{
			len=ip[i].first.length();
			for(int j=0; j<len-1; j++)
			{
				if(isalpha(ip[i].first[j])==false && isalpha(ip[i].first[j+1])==true)
				{
					ip[i].second=0;
					goto line1;
				}
			}
			ip[i].second=1;
line1:;
		}
		else
		{
			ip[i].second=1;
		}
	}
	string str="";
	string str1="";
	ll O_1=0;
	int mom=0;
	bool b2=false;
	int hran;
	int hramoct;

	for(int i=0; i<n; i++)
	{
		len=ip[i].first.length();
		mom=0;
		O_1=0;
		str="";
		str1="";
		b2=false;
		if(ip[i].second==1)
		{
			for(int j=len-1; j>=0; j--)
			{
				if(isalpha(ip[i].first[j])==false)
				{
					str+=ip[i].first[j];
				}
				else
				{
					str1+=ip[i].first[j];
					O_1+=((int)ip[i].first[j]-64)*(mom==0 ? 1 : mom *26);
					//cout<<((int)ip[i].first[j])<<endl;
					//cout<<O_1<<endl;
					mom++;
				}
			}
			reverse(str.begin(),str.end());
			cout<<'R'<<str<<'C'<<O_1;
		}
		else
		{
			for(int j=1; j<len; j++)
			{
				if(isalpha(ip[i].first[j])==false)
				{
					if(b2==false)
					{
						str+=ip[i].first[j];
					}
					else
					{
						str1+=ip[i].first[j];
					}
				}
				else
				{
					b2=true;
				}

			}

			istringstream ist(str1);
			ist>>hran;
			//������ � ���
			hramoct=hran%26;
			hran=hran/26;
			stringstream ss;
			ss<<hran;
			ss>>str1;
			//������ �������
			string helpf;
			///////
			//cout<<str1<<endl;
			int lym=str1.length();
			for(int j=0; j<lym; j++)
			{
				helpf+=((int)(hran)+64);
				//cout<<helpf<<endl;
			}
			//cout<<helpf<<endl;
			helpf+=(int)(hramoct+64);
			cout<<helpf<<str<<endl;
		}
	}

	return 0;
}


	#include <stdio.h>
	#include <string.h>

	#include <math.h>

	struct strings
	{
		char str[10001];
	};

	void MyFunk( char array2[], int j )
	{
		int i;
		int array1[10001];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[10001];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;

			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*pow( (double)26, (double)(kol-i) );

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * pow( (double)10, (double)(len-i-1) );

			}
//if ( array2[0]=='B' && array2[1]=='C' && array2[2]=='2' && array2[3]=='3' ) number++;
			printf( "R%iC%i\n", number2, number );

		}
	}

	int main ()
	{
	//clrscr();
		char array2[10001];
		strings s[10001];
	      //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str, i );
		}

		return 0;

	   }


#include <stdio.h>
#include <stdlib.h>

#include <stdio.h>
	#include <string.h>

	#include <math.h>

    char str[1002];

	void MyFunk( char array2[] )
	{
		int i;
		int array1[101];

		int len;
		int kol = 0;
		int kol2 = 0;

		char string[101];

		int number = 0;
		int number2 = 0;

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;
			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*ceil(pow( (double)26, (double)(kol-i) ));

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * ceil(pow( (double)10, (double)(len-i-1) ));

			}

			printf( "R%iC%i\n", number2, number );

		}
	}

int main()//(int argc, char *argv[])
{

		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &str );
			MyFunk( str );
		}

//		system("PAUSE");
  return 0;
}


	#include <stdio.h>
    //	#include <conio.h>
	#include <string.h>
	#include <math.h>

	int convertToNumber ( char * string, int len )
	{
		int i;
		int number=0;        	// PO ASII 'A' = 65

		for ( i=0; i<len; i++ )
		{
		      /*	if ( i==0 && string[i]=='Z' && len!=1 )
				number += 25*pow(26,i);
			else */
			number += (double)( (int)string[ len-1-i ] - 64 )*(double)pow((double)26,(double)i);
		}

		return number;
	}

	int convertNumbers ( char * string, int len, int kol )
	{
		int number=0;
		int i;

		for ( i=kol; i<len; i++ )
		{
			number += ( (int)string[i]-48 )*pow(10,len-i-1);
		}

		return number;
	}

	int getNumberOfLetters ( char *string, int len )
	{
		int i=0;
		int kol=0;

		while ( i<len )
		{
			if ( (int)string[i]>=65 && (int)string[i]<=90 )
			{
				kol++;
			}
			i++;
		}

		return kol;
	}

	/////////////////////////////////////////////////////

	void fromNumberToLetters ( int number ) // need doc
	{
		int r;
		int kol=0;
		int i = 0;
		char array[10];
		int mem=0;

		if ( number <= 26 )
		{
			array[i] = (char)(number+64);
		}
		else
		{
			if ( i == 0 )
			{
				r = number%26;

				if ( r == 0 )
				{
					r = 26;
				}
				array[i] = (char)(r+64);
				number = number - r;
				i++;
			}

			while ( number != 0 )
			{
				number /= pow( (double)26, (double)i );
				if ( mem!=0 )
				{
					number += mem;
					number /= pow( (double)26, (double)i );
					mem = 0;
				}
				if ( number==0 )
				{
					break;
				}
				if ( number > 26 )
				{
					r = number%26;
					mem = (number-r)*pow( (double)26, (double)i );
					array[i] = (char)(r+64);
					number -= r;
					i++;

				}
				else
				{
					array[i] = (char)(number+64);
					i++;
				}
			}
		       // printf( "111" );
		}

	 //	printf( "letters=== %s", array );
		if ( i>1 )
                	i--;

		while ( i>=0 )
		{
			if ( array[i]!=' ' )
				printf( "%c", array[i] );
			i--;
		}

	}

	void mainFunktion ( char * stroka, int stringLength )
	{
		int col;
		int row;

		col = convertToNumber( stroka, getNumberOfLetters(stroka, stringLength) );
		row = convertNumbers( stroka, stringLength, getNumberOfLetters(stroka, stringLength) );

		printf( "R%dC%d\n", row, col );
	}
	/////////////////////////////////////

	int getIndex( char * stroka )
	{
		int i=0;
		while ( 1 )
		{
			if ( stroka[i] == 'C' )
				break;

			i++;
		}

		return i+1;
	}

	void mainFunktion2 ( char * stroka, int stringLength )
	{
		int i;
		int index;

		index = getIndex(stroka);

	      //	printf( "convertNum--->%d", convertNumbers ( stroka, stringLength, getIndex(stroka) ) );
		fromNumberToLetters( convertNumbers ( stroka, stringLength, index ) ) ;

		for ( i=1; i<index-1; i++ )
		{
			printf( "%c", stroka[i] );
		}
		printf( "\n" );

	}

	int main ()
	{
	     //	clrscr();

		char * stroka = new char;

		int stringLength;
		int number;
		int n;
		int i;

		scanf( "%d", &n );

		for ( i=0; i<n; i++ )
		{
		       //	char * stroka = new char;
			scanf( "%s", stroka );
			if ( stroka[0] != 'R' )
			{
				stringLength = strlen( stroka );
				mainFunktion( stroka, stringLength );
			}
			else
			{
				stringLength = strlen( stroka );
				mainFunktion2( stroka, stringLength );
			}

		      //	delete [] stroka;

		}

	     //	getch();
	     return 0;
	}


#include <iostream>
#include <stdlib.h>
#include <string.h>

using namespace std;
char str [100] = {0};
char s[100];

int row, col;

///////////////////// FUNKTSIYA VOZVEDENIYA V STEPEN
int myPow( int num, int i )
{
    int result = 1;

    for ( int j=0; j<i; j++ )
    {
        result *= num;
    }

    return result;
}

////////// IZ BUKV V TSIFRI
int toNumber ( int n, int m )
{
    int i;
    int num=0;
    int pow = m-n;

    for( i=n; i<=m; i++ )
    {
        num += (s[i]-48)*myPow(10,pow);
        pow--;
    }

    return num;
}
/*
///////////////////// FUNKSIYA OPREDELYAET KOLICHESTVO BUKV DLYA PREDSTABLENIYA
int numberOfLetters( int num )
{
    int result = 0;
    int i = 1;

    while( num > 0 )
    {
        result++;
        num -= myPow(26,i);

        i++;
    }

    return result;
}
*/

void toLetters( int num )
{
    int i=0,j;
    int m=0;
    //int n = numberOfLetters( num );
    //int n2=n;

    while (num)
    {
        str[i] = num % 26;
        num /= 26;

        i++;
        m++; // KOLICHESTVO
    }

    for ( i=0; i<m-1; i++ )
    {
        if ( str[i]<=0 )
        {
                str[i+1] -= 1;
                str[i] += 26;
        }
    }

    for ( i=m-1; i>=0; i-- )
    {   // printf( "-->str[i]%d", str[i] );
           if ( str[i] == 0 )
                      continue;

           printf( "%c", str[i]+64 );
    }

}

//////////// IZ BUKV V TSIFRI (AAA = 702)
int letToNum ()
{
    col = 0;
    int i;
    int l = 0;

    for ( i=0; i<strlen(s); i++ )
    {
        if ( !(s[i]>='A' && s[i]<='Z') )
        {
                break;
        }
    }

    row = toNumber( i, strlen(s)-1 );

    for ( i=i-1; i>=0; i-- )
    {
        col += (s[i] - 64)*myPow( 26, l );
        l++;
    }

    return col;
}

/////////////////////// MAIN

int main(int argc, char *argv[])
{
    int n;
    int i;
    int flag=2;

    scanf( "%d\n", &n );

    while (n--)
    {
        memset( str, 0, sizeof(str) );
        memset( s, 0, sizeof(s) );
        row = 0; col = 0;
        scanf( "\n%s", &s );

        for ( int j=strlen(s)-1; j>0; j-- )
        {
                if ( s[j] == 'C' && (s[j-1]<=57&&s[j-1]>=48) )
                {
                           flag=1;
                }
        }

        if ( flag==1 )
        {
                for ( i=1; i<100; i++ )
                {
                        if ( s[i] == 'C' )
                           break;
                }

                row = toNumber( 1, i-1 );

                col = toNumber( i+1, strlen(s)-1 );

                toLetters( col );
                printf( "%d", row );
        }
        else
        {
                letToNum();

                printf( "R%dC%d", row, col );
        }
    }

   // toLetters( 740 );

    //printf( "%d\n", myPow(4,1) );
//    printf( "%d\n", numberOfLetters(702) );

  return 0;
}


#include <stdio.h>
#include <stdlib.h>

#include <stdio.h>
	#include <string.h>

	#include <math.h>

//	public struct strings
//	{
//		char str[101];
//	};

	void MyFunk( char array2[], int j )
	{
		int i;
		int array1[101];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[101];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;
			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*ceil(pow( (double)26, (double)(kol-i) ));

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * ceil(pow( (double)10, (double)(len-i-1) ));

			}
//if ( array2[0]=='B' && array2[1]=='C' && array2[2]=='2' && array2[3]=='3' ) number++;
			printf( "R%iC%i\n", number2, number );

		}
	}

int main()//(int argc, char *argv[])
{
	struct strings
	{
		char str[1001];
	}s[2000];

  //clrscr();
		char array2[10000];

	       //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str, i );
		}
	//system("PAUSE");

  return 0;
}


#include<stdio.h>
#include<conio.h>
using namespace std;
char push_left(char in,int push)
{
  char a,b,r;
  int i=push%8;
  a=(int)in<<i;
  printf( "a-->%i\n", a );
  b=in>>8-i;
  r=a|b;

  printf( "ASII-->%i\n", 'A' );
  return r;
}
int main()
{
  unsigned int a,b;
  a=int('s');
    printf("%i %c\n",a,push_left('A',1));
    printf("%i %c\n",a,push_left('S',5));
  getch();
}


	#include <stdio.h>
    //	#include <conio.h>
	#include <string.h>
	#include <math.h>

	int convertToNumber ( char * string, int len )
	{
		int i;
		int number=0;        	// PO ASII 'A' = 65

		for ( i=0; i<len; i++ )
		{
		      /*	if ( i==0 && string[i]=='Z' && len!=1 )
				number += 25*pow(26,i);
			else */
			number += ( (int)string[ len-1-i ] - 64 )*pow(26,i);
		}

		return number;
	}

	int convertNumbers ( char * string, int len, int kol )
	{
		int number=0;
		int i;

		for ( i=kol; i<len; i++ )
		{
			number += ( (int)string[i]-48 )*pow(10,len-i-1);
		}

		return number;
	}

	int getNumberOfLetters ( char *string, int len )
	{
		int i=0;
		int kol=0;

		while ( i<len )
		{
			if ( (int)string[i]>=65 && (int)string[i]<=90 )
			{
				kol++;
			}
			i++;
		}

		return kol;
	}

	/////////////////////////////////////////////////////

	void fromNumberToLetters ( int number ) // need doc
	{
		int r;
		int kol=0;
		int i = 0;
		char array[10];
		int mem=0;

		if ( number <= 26 )
		{
			array[i] = (char)(number+64);
		}
		else
		{
			if ( i == 0 )
			{
				r = number%26;

				if ( r == 0 )
				{
					r = 26;
				}
				array[i] = (char)(r+64);
				number = number - r;
				i++;
			}

			while ( number != 0 )
			{
				number /= pow( (double)26, (double)i );
				if ( mem!=0 )
				{
					number += mem;
					number /= pow( (double)26, (double)i );
					mem = 0;
				}
				if ( number==0 )
				{
					break;
				}
				if ( number > 26 )
				{
					r = number%26;
					mem = (number-r)*pow( (double)26, (double)i );
					array[i] = (char)(r+64);
					number -= r;
					i++;

				}
				else
				{
					array[i] = (char)(number+64);
					i++;
				}
			}
		       // printf( "111" );
		}

	 //	printf( "letters=== %s", array );
		if ( i>1 )
                	i--;

		while ( i>=0 )
		{
			if ( array[i]!=' ' )
				printf( "%c", array[i] );
			i--;
		}

	}

	void mainFunktion ( char * stroka, int stringLength )
	{
		int col;
		int row;

		col = convertToNumber( stroka, getNumberOfLetters(stroka, stringLength) );
		row = convertNumbers( stroka, stringLength, getNumberOfLetters(stroka, stringLength) );

		printf( "R%dC%d", row, col );
	}
	/////////////////////////////////////

	int getIndex( char * stroka )
	{
		int i=0;
		while ( 1 )
		{
			if ( stroka[i] == 'C' )
				break;

			i++;
		}

		return i+1;
	}

	void mainFunktion2 ( char * stroka, int stringLength )
	{
		int i;
		int index;

		index = getIndex(stroka);

	      //	printf( "convertNum--->%d", convertNumbers ( stroka, stringLength, getIndex(stroka) ) );
		fromNumberToLetters( convertNumbers ( stroka, stringLength, index ) ) ;

		for ( i=1; i<index-1; i++ )
		{
			printf( "%c", stroka[i] );
		}

	}

	void main ()
	{
	     //	clrscr();

		char * stroka = new char;

		int stringLength;
		int number;
		int n;
		int i;

		scanf( "%d", &n );

		for ( i=0; i<n; i++ )
		{
		       //	char * stroka = new char;
			scanf( "%s", stroka );
			if ( stroka[0] != 'R' )
			{
				stringLength = strlen( stroka );
				mainFunktion( stroka, stringLength );
			}
			else
			{
				stringLength = strlen( stroka );
				mainFunktion2( stroka, stringLength );
			}

		      //	delete [] stroka;

		}

	     //	getch();
	}


#include <iostream>
#include <stdlib.h>
#include <string.h>

using namespace std;
char str [100] = {0};
char s[100] = {0};

int row, col;

///////////////////// FUNKTSIYA VOZVEDENIYA V STEPEN
int myPow( int num, int i )
{
    int result = 1;

    for ( int j=0; j<i; j++ )
    {
        result *= num;
    }

    return result;
}

////////// IZ BUKV V TSIFRI
int toNumber ( int n, int m )
{
    int i;
    int num=0;
    int pow = m-n;

    for( i=n; i<=m; i++ )
    {
        num += (s[i]-48)*myPow(10,pow);
        pow--;
    }

    return num;
}
/*
///////////////////// FUNKSIYA OPREDELYAET KOLICHESTVO BUKV DLYA PREDSTABLENIYA
int numberOfLetters( int num )
{
    int result = 0;
    int i = 1;

    while( num > 0 )
    {
        result++;
        num -= myPow(26,i);

        i++;
    }

    return result;
}
*/

void toLetters( int num )
{
    int i=0,j;
    int m=0;
    //int n = numberOfLetters( num );
    //int n2=n;

    while (num)
    {
        str[i] = num % 26;
        num /= 26;

        i++;
        m++; // KOLICHESTVO
    }

    for ( i=0; i<m-1; i++ )
    {
        if ( str[i]<=0 )
        {
                str[i+1] -= 1;
                str[i] += 26;
        }
    }

    for ( i=m-1; i>=0; i-- )
    {   // printf( "-->str[i]%d", str[i] );
           if ( str[i] == 0 )
                      continue;

           printf( "%c", str[i]+64 );
    }

     printf( "%d", row );             printf( "\n" );

}

//////////// IZ BUKV V TSIFRI (AAA = 702)
int letToNum ()
{
    col = 0;
    int i;
    int l = 0;

    for ( i=0; i<strlen(s); i++ )
    {
        if ( !(s[i]>='A' && s[i]<='Z') )
        {
                break;
        }
    }

    row = toNumber( i, strlen(s)-1 );

    for ( i=i-1; i>=0; i-- )
    {
        col += (s[i] - 64)*myPow( 26, l );
        l++;
    }

    return col;
}

/////////////////////// MAIN

int main(int argc, char *argv[])
{
    int n;
    int i;
    int flag=2;

    scanf( "%d\n", &n );
    //getchar();

    while (n--)
    {
        memset( str, 0, sizeof(str) );

       // memset( s, 0, sizeof(s) );

        scanf( "\n%s", &s );
        //gets(s);
flag=2;
        for ( int j=strlen(s)-1; j>0; j-- )
        {
                if ( s[j] == 'C' && (s[j-1]<=57&&s[j-1]>=48) )
                {
                           flag=1;
                }
        }

        if ( flag==1 )
        {
                for ( i=1; i<strlen(s); i++ )
                {
                        if ( s[i] == 'C' )
                           break;
                }

                row = toNumber( 1, i-1 );

                col = toNumber( i+1, strlen(s)-1 );

                toLetters( col );

        }
        else
        {
                letToNum();

                printf( "R%dC%d\n", row, col );
        }

    }

   // toLetters( 740 );

    //printf( "%d\n", myPow(4,1) );
//    printf( "%d\n", numberOfLetters(702) );

  return 0;
}


	#include <stdio.h>
    //	#include <conio.h>
	#include <string.h>
	#include <math.h>

	int convertToNumber ( char * string, int len )
	{
		int i;
		int number=0;        	// PO ASII 'A' = 65

		for ( i=0; i<len; i++ )
		{
		      /*	if ( i==0 && string[i]=='Z' && len!=1 )
				number += 25*pow(26,i);
			else */
			number += (double)( (int)string[ len-1-i ] - 64 )*(double)pow((double)26,i);
		}

		return number;
	}

	int convertNumbers ( char * string, int len, int kol )
	{
		int number=0;
		int i;

		for ( i=kol; i<len; i++ )
		{
			number += ( (int)string[i]-48 )*pow((double)10,len-i-1);
		}

		return number;
	}

	int getNumberOfLetters ( char *string, int len )
	{
		int i=0;
		int kol=0;

		while ( i<len )
		{
			if ( (int)string[i]>=65 && (int)string[i]<=90 )
			{
				kol++;
			}
			i++;
		}

		return kol;
	}

	/////////////////////////////////////////////////////

	void fromNumberToLetters ( int number ) // need doc
	{
		int r;
		int kol=0;
		int i = 0;
		char array[100];
		int mem=0;

		if ( number <= 26 )
		{
			array[i] = (char)(number+64);
		}
		else
		{
			if ( i == 0 )
			{
				r = number%26;

				if ( r == 0 )
				{
					r = 26;
				}
				array[i] = (char)(r+64);
				number = number - r;
				i++;
			}

			while ( number != 0 )
			{
				number /= pow( (double)26, i );
				if ( mem!=0 )
				{
					number += mem;
					number /= pow( (double)26, i );
					mem = 0;
				}
				if ( number==0 )
				{
					break;
				}
				if ( number > 26 )
				{
					r = number%26;
					mem = (number-r)*pow( (double)26, i );
					array[i] = (char)(r+64);
					number -= r;
					i++;

				}
				else
				{
					array[i] = (char)(number+64);
					i++;
				}
			}
		       // printf( "111" );
		}

	 //	printf( "letters=== %s", array );
		if ( i>1 )
			i--;

		while ( i>=0 )
		{
			if ( array[i]!=' ' )
				printf( "%c", array[i] );
			i--;
		}

	}

	void mainFunktion ( char * stroka, int stringLength )
	{
		int col;
		int row;

		col = convertToNumber( stroka, getNumberOfLetters(stroka, stringLength) );
		row = convertNumbers( stroka, stringLength, getNumberOfLetters(stroka, stringLength) );

		printf( "R%dC%d\n", row, col );
	}
	/////////////////////////////////////

	int getIndex( char * stroka )
	{
		int i=0;
		while ( 1 )
		{
			if ( stroka[i] == 'C' )
				break;

			i++;
		}

		return i+1;
	}

	void mainFunktion2 ( char * stroka, int stringLength )
	{
		int i;
		int index;

		index = getIndex(stroka);

	      //	printf( "convertNum--->%d", convertNumbers ( stroka, stringLength, getIndex(stroka) ) );
		fromNumberToLetters( convertNumbers ( stroka, stringLength, index ) ) ;

		for ( i=1; i<index-1; i++ )
		{
			printf( "%c", stroka[i] );
		}
		printf( "\n" );

	}

	int main ()
	{
	     //	clrscr();

		char * stroka = new char;

		int stringLength;
		int number;
		int n;
		int i;

		scanf( "%d", &n );

		for ( i=0; i<n; i++ )
		{
		       //	char * stroka = new char;
			scanf( "%s", stroka );
			if ( stroka[0] != 'R' )
			{
				stringLength = strlen( stroka );
				mainFunktion( stroka, stringLength );
			}
			else
			{
				stringLength = strlen( stroka );
				mainFunktion2( stroka, stringLength );
			}

		      //	delete [] stroka;

		}

	     //	getch();
	     return 0;
	}


#include <stdio.h>
#include <stdlib.h>

#include <stdio.h>
	#include <string.h>

	#include <math.h>

    char str[1002];

	void MyFunk( char array2[] )
	{
		int i;
		int array1[101];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[101];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;
			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*ceil(pow( (double)26, (double)(kol-i) ));

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * ceil(pow( (double)10, (double)(len-i-1) ));

			}
//if ( array2[0]=='B' && array2[1]=='C' && array2[2]=='2' && array2[3]=='3' ) number++;
			printf( "R%iC%i\n", number2, number );

		}
	}

int main()//(int argc, char *argv[])
{
/*	struct strings
	{
		char str[1011];
	}s[2000];
*/
//s2[0].str[0]='q';
//printf( "%c", s2[0].str[0] );
  //clrscr();

	       //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &str );
			MyFunk( str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{

		}

//		system("PAUSE");
  return 0;
}


#include <stdio.h>
	#include <string.h>

	#include <math.h>

	struct strings
	{
		char str[101];
	};

	void MyFunk( char array2[] )
	{
		int i;
		int array1[100];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[100];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( 10, kol-i-1 );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( 10, kol2-i-1 );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;

			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*pow( 26, kol-i );

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * pow( 10, len-i-1 );

			}

			printf( "R%iC%i\n", number2, number );

		}
	}

	void main ()
	{
	//clrscr();
		char array2[101];
		strings s[101];
	      //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str );
		}

	   }


	#include <stdio.h>
    //	#include <conio.h>
	#include <string.h>
	#include <math.h>

	int convertToNumber ( char * string, int len )
	{
		int i;
		int number=0;        	// PO ASII 'A' = 65

		for ( i=0; i<len; i++ )
		{
		      /*	if ( i==0 && string[i]=='Z' && len!=1 )
				number += 25*pow(26,i);
			else */
			number += (double)( (int)string[ len-1-i ] - 64 )*(double)pow((double)26,i);
		}

		return number;
	}

	int convertNumbers ( char * string, int len, int kol )
	{
		int number=0;
		int i;

		for ( i=kol; i<len; i++ )
		{
			number += ( (int)string[i]-48 )*pow(10,len-i-1);
		}

		return number;
	}

	int getNumberOfLetters ( char *string, int len )
	{
		int i=0;
		int kol=0;

		while ( i<len )
		{
			if ( (int)string[i]>=65 && (int)string[i]<=90 )
			{
				kol++;
			}
			i++;
		}

		return kol;
	}

	/////////////////////////////////////////////////////

	void fromNumberToLetters ( int number ) // need doc
	{
		int r;
		int kol=0;
		int i = 0;
		char array[10];
		int mem=0;

		if ( number <= 26 )
		{
			array[i] = (char)(number+64);
		}
		else
		{
			if ( i == 0 )
			{
				r = number%26;

				if ( r == 0 )
				{
					r = 26;
				}
				array[i] = (char)(r+64);
				number = number - r;
				i++;
			}

			while ( number != 0 )
			{
				number /= pow( (double)26, i );
				if ( mem!=0 )
				{
					number += mem;
					number /= pow( (double)26, i );
					mem = 0;
				}
				if ( number==0 )
				{
					break;
				}
				if ( number > 26 )
				{
					r = number%26;
					mem = (number-r)*pow( (double)26, i );
					array[i] = (char)(r+64);
					number -= r;
					i++;

				}
				else
				{
					array[i] = (char)(number+64);
					i++;
				}
			}
		       // printf( "111" );
		}

	 //	printf( "letters=== %s", array );
		if ( i>1 )
			i--;

		while ( i>=0 )
		{
			if ( array[i]!=' ' )
				printf( "%c", array[i] );
			i--;
		}

	}

	void mainFunktion ( char * stroka, int stringLength )
	{
		int col;
		int row;

		col = convertToNumber( stroka, getNumberOfLetters(stroka, stringLength) );
		row = convertNumbers( stroka, stringLength, getNumberOfLetters(stroka, stringLength) );

		printf( "R%dC%d\n", row, col );
	}
	/////////////////////////////////////

	int getIndex( char * stroka )
	{
		int i=0;
		while ( 1 )
		{
			if ( stroka[i] == 'C' )
				break;

			i++;
		}

		return i+1;
	}

	void mainFunktion2 ( char * stroka, int stringLength )
	{
		int i;
		int index;

		index = getIndex(stroka);

	      //	printf( "convertNum--->%d", convertNumbers ( stroka, stringLength, getIndex(stroka) ) );
		fromNumberToLetters( convertNumbers ( stroka, stringLength, index ) ) ;

		for ( i=1; i<index-1; i++ )
		{
			printf( "%c", stroka[i] );
		}
		printf( "\n" );

	}

	int main ()
	{
	     //	clrscr();

		char * stroka = new char;

		int stringLength;
		int number;
		int n;
		int i;

		scanf( "%d", &n );

		for ( i=0; i<n; i++ )
		{
		       //	char * stroka = new char;
			scanf( "%s", stroka );
			if ( stroka[0] != 'R' )
			{
				stringLength = strlen( stroka );
				mainFunktion( stroka, stringLength );
			}
			else
			{
				stringLength = strlen( stroka );
				mainFunktion2( stroka, stringLength );
			}

		      //	delete [] stroka;

		}

	     //	getch();
	     return 0;
	}


	#include <stdio.h>
	#include <string.h>

	#include <math.h>

	struct strings
	{
		char str[10001];
	};

	void MyFunk( char array2[], int j )
	{
		int i;
		int array1[100001];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[100001];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;

			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*pow( (double)26, (double)(kol-i) );

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * pow( (double)10, (double)(len-i-1) );

			}
//if ( array2[0]=='B' && array2[1]=='C' && array2[2]=='2' && array2[3]=='3' ) number++;
			printf( "R%iC%i\n", number2, number );

		}
	}

	int main ()
	{
	//clrscr();
		char array2[10001];
		strings s[10001];
	      //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str, i );
		}

		return 0;

	   }


	#include <stdio.h>
	#include <string.h>

	#include <math.h>

	struct strings
	{
		char str[101];
	};

	void MyFunk( char array2[], int j )
	{
		int i;
		int array1[100];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[100];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( 10, kol-i-1 );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( 10, kol2-i-1 );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;

			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*pow( 26, kol-i );

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * pow( 10, len-i-1 );

			}

			printf( "R%iC%i\n", number2, number );

		}
	}

	int main ()
	{
	//clrscr();
		char array2[101];
		strings s[101];
	      //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str, i );
		}

		return 0;

	   }///


#include <stdio.h>
#include <stdlib.h>

#include <stdio.h>
	#include <string.h>

	#include <math.h>

	void MyFunk( char array2[], int j )
	{
		int i;
		int array1[101];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[101];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;
			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*ceil(pow( (double)26, (double)(kol-i) ));

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * ceil(pow( (double)10, (double)(len-i-1) ));

			}
//if ( array2[0]=='B' && array2[1]=='C' && array2[2]=='2' && array2[3]=='3' ) number++;
			printf( "R%iC%i\n", number2, number );

		}
	}

int main()//(int argc, char *argv[])
{
	struct strings
	{
		char str[1011];
	}s[2000];

//s2[0].str[0]='q';
//printf( "%c", s2[0].str[0] );
  //clrscr();
		char array2[10000];

	       //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str, i );
		}

//system("PAUSE");

  return 0;
}


	#include <stdio.h>
    //	#include <conio.h>
	#include <string.h>
	#include <math.h>

	int convertToNumber ( char * string, int len )
	{
		int i;
		int number=0;        	// PO ASII 'A' = 65

		for ( i=0; i<len; i++ )
		{
		      /*	if ( i==0 && string[i]=='Z' && len!=1 )
				number += 25*pow(26,i);
			else */
			number += (double)( (int)string[ len-1-i ] - 64 )*(double)pow((double)26,i);
		}

		return number;
	}

	int convertNumbers ( char * string, int len, int kol )
	{
		int number=0;
		int i;

		for ( i=kol; i<len; i++ )
		{
			number += ( (int)string[i]-48 )*pow((double)10,len-i-1);
		}

		return number;
	}

	int getNumberOfLetters ( char *string, int len )
	{
		int i=0;
		int kol=0;

		while ( i<len )
		{
			if ( (int)string[i]>=65 && (int)string[i]<=90 )
			{
				kol++;
			}
			i++;
		}

		return kol;
	}

	/////////////////////////////////////////////////////

	void fromNumberToLetters ( int number ) // need doc
	{
		int r;
		int kol=0;
		int i = 0;
		char *array = new char;
		int mem=0;

		if ( number <= 26 )
		{
			array[i] = (char)(number+64);
		}
		else
		{
			if ( i == 0 )
			{
				r = number%26;

				if ( r == 0 )
				{
					r = 26;
				}
				array[i] = (char)(r+64);
				number = number - r;
				i++;
			}

			while ( number != 0 )
			{
				number /= pow( (double)26, i );
				if ( mem!=0 )
				{
					number += mem;
					number /= pow( (double)26, i );
					mem = 0;
				}
				if ( number==0 )
				{
					break;
				}
				if ( number > 26 )
				{
					r = number%26;
					mem = (number-r)*pow( (double)26, i );
					array[i] = (char)(r+64);
					number -= r;
					i++;

				}
				else
				{
					array[i] = (char)(number+64);
					i++;
				}
			}
		       // printf( "111" );
		}

	 //	printf( "letters=== %s", array );
		if ( i>1 )
			i--;

		while ( i>=0 )
		{
			if ( array[i]!=' ' )
				printf( "%c", array[i] );
			i--;
		}

	}

	void mainFunktion ( char * stroka, int stringLength )
	{
		int col;
		int row;

		col = convertToNumber( stroka, getNumberOfLetters(stroka, stringLength) );
		row = convertNumbers( stroka, stringLength, getNumberOfLetters(stroka, stringLength) );

		printf( "R%dC%d\n", row, col );
	}
	/////////////////////////////////////

	int getIndex( char * stroka )
	{
		int i=0;
		while ( 1 )
		{
			if ( stroka[i] == 'C' )
				break;

			i++;
		}

		return i+1;
	}

	void mainFunktion2 ( char * stroka, int stringLength )
	{
		int i;
		int index;

		index = getIndex(stroka);

	      //	printf( "convertNum--->%d", convertNumbers ( stroka, stringLength, getIndex(stroka) ) );
		fromNumberToLetters( convertNumbers ( stroka, stringLength, index ) ) ;

		for ( i=1; i<index-1; i++ )
		{
			printf( "%c", stroka[i] );
		}
		printf( "\n" );

	}

	int main ()
	{
	     //	clrscr();

		char * stroka = new char;

		int stringLength;
		int number;
		int n;
		int i;

		scanf( "%d", &n );

		for ( i=0; i<n; i++ )
		{
		       //	char * stroka = new char;
			scanf( "%s", stroka );
			if ( stroka[0] != 'R' )
			{
				stringLength = strlen( stroka );
				mainFunktion( stroka, stringLength );
			}
			else
			{
				stringLength = strlen( stroka );
				mainFunktion2( stroka, stringLength );
			}

		      //	delete [] stroka;

		}

	     //	getch();
	     return 0;
	}


	#include <stdio.h>
    //	#include <conio.h>
	#include <string.h>
	#include <math.h>

	int convertToNumber ( char * string, int len )
	{
		int i;
		int number=0;        	// PO ASII 'A' = 65

		for ( i=0; i<len; i++ )
		{
		      /*	if ( i==0 && string[i]=='Z' && len!=1 )
				number += 25*pow(26,i);
			else */
			number += (double)( (int)string[ len-1-i ] - 64 )*(double)pow((double)26,i);
		}

		return number;
	}

	int convertNumbers ( char * string, int len, int kol )
	{
		int number=0;
		int i;

		for ( i=kol; i<len; i++ )
		{
			number += ( (int)string[i]-48 )*pow((double)10,len-i-1);
		}

		return number;
	}

	int getNumberOfLetters ( char *string, int len )
	{
		int i=0;
		int kol=0;

		while ( i<len )
		{
			if ( (int)string[i]>=65 && (int)string[i]<=90 )
			{
				kol++;
			}
			i++;
		}

		return kol;
	}

	/////////////////////////////////////////////////////

	void fromNumberToLetters ( int number ) // need doc
	{
		int r;
		int kol=0;
		int i = 0;
		char array[10];
		int mem=0;

		if ( number <= 26 )
		{
			array[i] = (char)(number+64);
		}
		else
		{
			if ( i == 0 )
			{
				r = number%26;

				if ( r == 0 )
				{
					r = 26;
				}
				array[i] = (char)(r+64);
				number = number - r;
				i++;
			}

			while ( number != 0 )
			{
				number /= pow( (double)26, i );
				if ( mem!=0 )
				{
					number += mem;
					number /= pow( (double)26, i );
					mem = 0;
				}
				if ( number==0 )
				{
					break;
				}
				if ( number > 26 )
				{
					r = number%26;
					mem = (number-r)*pow( (double)26, i );
					array[i] = (char)(r+64);
					number -= r;
					i++;

				}
				else
				{
					array[i] = (char)(number+64);
					i++;
				}
			}
		       // printf( "111" );
		}

	 //	printf( "letters=== %s", array );
		if ( i>1 )
			i--;

		while ( i>=0 )
		{
			if ( array[i]!=' ' )
				printf( "%c", array[i] );
			i--;
		}

	}

	void mainFunktion ( char * stroka, int stringLength )
	{
		int col;
		int row;

		col = convertToNumber( stroka, getNumberOfLetters(stroka, stringLength) );
		row = convertNumbers( stroka, stringLength, getNumberOfLetters(stroka, stringLength) );

		printf( "R%dC%d\n", row, col );
	}
	/////////////////////////////////////

	int getIndex( char * stroka )
	{
		int i=0;
		while ( 1 )
		{
			if ( stroka[i] == 'C' )
				break;

			i++;
		}

		return i+1;
	}

	void mainFunktion2 ( char * stroka, int stringLength )
	{
		int i;
		int index;

		index = getIndex(stroka);

	      //	printf( "convertNum--->%d", convertNumbers ( stroka, stringLength, getIndex(stroka) ) );
		fromNumberToLetters( convertNumbers ( stroka, stringLength, index ) ) ;

		for ( i=1; i<index-1; i++ )
		{
			printf( "%c", stroka[i] );
		}
		printf( "\n" );

	}

	int main ()
	{
	     //	clrscr();

		char * stroka = new char;

		int stringLength;
		int number;
		int n;
		int i;

		scanf( "%d", &n );

		for ( i=0; i<n; i++ )
		{
		       //	char * stroka = new char;
			scanf( "%s", stroka );
			if ( stroka[0] != 'R' )
			{
				stringLength = strlen( stroka );
				mainFunktion( stroka, stringLength );
			}
			else
			{
				stringLength = strlen( stroka );
				mainFunktion2( stroka, stringLength );
			}

		      //	delete [] stroka;

		}

	     //	getch();
	     return 0;
	}


	#include <stdio.h>
	#include <string.h>

	#include <math.h>

	struct strings
	{
		char str[101];
	};

	void MyFunk( char array2[], int j )
	{
		int i;
		int array1[100];
	    //	char array2[100];
		int len;
		int kol = 0;
		int kol2 = 0;

		char string[100];

		int number = 0;
		int number2 = 0;
	    //	printf( "Vvedite stroku" );

	     //	scanf( "%s", &array2 );

		len = strlen(array2);

		if ( array2[0] == 'R')
		{
	  // PEREVOD STROKI V MASSIV TSIFR

			int j=0;

			for ( i=0; array2[i]!='C'; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol++;
					array1[j] = array2[i] - 48;

					j++;
				}

			}

			int buf = i; // sohranyaem index

		 // IZ MASSIVA TSIFR V CHISLO 'number'

			for ( i=0; i<kol; i++ )
			{
				number += array1[i]*pow( (double)10, (double)(kol-i-1) );
			}

			j=0;

			for ( i=buf+1; i<len; i++ )
			{
				if ( array2[i] < 58 )
				{
					kol2++;
					array1[j] = array2[i] - 48;
					j++;
				}

			}

			for ( i=0; i<kol2; i++ )
			{
				number2 += array1[i]*pow( (double)10, (double)(kol2-i-1) );
			}

			i=0;
			kol=0;

		 // IZ CHISLA 'number' V 27-YU SISTEMU SCHISLENIYA (kak b MsExel)

			while ( number2 >= 1 )
			{
				if ( number2%26 == 0 )
				{
					string[i] = 'Z';

					number2 = (number2 /= 26) -1;
				}
				else
				{
					string[i] = (number2%26 + 64);
					number2 /= 26;
				}

				i++;
				kol++;
			}

			for ( i=kol-1; i>=0; i-- )
			{
				printf( "%c", string[i] );
			}
			printf( "%i\n", number );
		}
		else
		{
			for ( i=0; i<len; i++ )
			{
				if ( array2[i] > 57 )
					kol++;

			}

			for ( i=1; i<=kol; i++ )
			{
				number += (array2[i-1]-64)*pow( (double)26, (double)(kol-i) );

			}

			for ( i=kol; i<len; i++ )
			{
				number2 += (array2[i]-48) * pow( (double)10, (double)(len-i-1) );

			}
//if ( array2[0]=='B' && array2[1]=='C' && array2[2]=='2' && array2[3]=='3' ) number++;
			printf( "R%iC%i\n", number2, number );

		}
	}

	int main ()
	{
	//clrscr();
		char array2[101];
		strings s[101];
	      //	scanf( "%s", array2 );
		int n;
		int i;
		scanf( "%i", &n );

		for ( i=0; i<n; i++ )
		{
			scanf( "%s", &s[i].str );
		}

      /*		for ( i=0; i<n; i++ )
		{
			printf( "%s\n", s[i].str );
		}
      */

		for ( i=0; i<n; i++ )
		{
			MyFunk( s[i].str, i );
		}

		return 0;

	   }


#include <iostream>
#include <stdlib.h>
#include <string.h>

using namespace std;
char str [100] = {0};
char s[100];

int row, col;

///////////////////// FUNKTSIYA VOZVEDENIYA V STEPEN
int myPow( int num, int i )
{
    int result = 1;

    for ( int j=0; j<i; j++ )
    {
        result *= num;
    }

    return result;
}

////////// IZ BUKV V TSIFRI
int toNumber ( int n, int m )
{
    int i;
    int num=0;
    int pow = m-n;

    for( i=n; i<=m; i++ )
    {
        num += (s[i]-48)*myPow(10,pow);
        pow--;
    }

    return num;
}
/*
///////////////////// FUNKSIYA OPREDELYAET KOLICHESTVO BUKV DLYA PREDSTABLENIYA
int numberOfLetters( int num )
{
    int result = 0;
    int i = 1;

    while( num > 0 )
    {
        result++;
        num -= myPow(26,i);

        i++;
    }

    return result;
}
*/

void toLetters( int num )
{
    int i=0,j;
    int m=0;
    //int n = numberOfLetters( num );
    //int n2=n;

    while (num)
    {
        str[i] = num % 26;
        num /= 26;

        i++;
        m++; // KOLICHESTVO
    }

    for ( i=0; i<m-1; i++ )
    {
        if ( str[i]<=0 )
        {
                str[i+1] -= 1;
                str[i] += 26;
        }
    }

    for ( i=m-1; i>=0; i-- )
    {   // printf( "-->str[i]%d", str[i] );
           if ( str[i] == 0 )
                      continue;

           printf( "%c", str[i]+64 );
    }

}

//////////// IZ BUKV V TSIFRI (AAA = 702)
int letToNum ()
{
    col = 0;
    int i;
    int l = 0;

    for ( i=0; i<strlen(s); i++ )
    {
        if ( !(s[i]>='A' && s[i]<='Z') )
        {
                break;
        }
    }

    row = toNumber( i, strlen(s)-1 );

    for ( i=i-1; i>=0; i-- )
    {
        col += (s[i] - 64)*myPow( 26, l );
        l++;
    }

    return col;
}

/////////////////////// MAIN

int main(int argc, char *argv[])
{
    int n;
    int i;
    int flag=2;

    scanf( "%d\n", &n );

    while (n--)
    {
        memset( str, 0, sizeof(str) );
        memset( s, 0, sizeof(s) );
        row = 0; col = 0;
        scanf( "%s", &s );

        for ( int j=strlen(s)-1; j>0; j-- )
        {
                if ( s[j] == 'C' && (s[j-1]<=57&&s[j-1]>=48) )
                {
                           flag=1;
                }
        }

        if ( flag==1 )
        {
                for ( i=1; i<100; i++ )
                {
                        if ( s[i] == 'C' )
                           break;
                }

                row = toNumber( 1, i-1 );

                col = toNumber( i+1, strlen(s)-1 );

                toLetters( col );
                printf( "%d", row );
        }
        else
        {
                letToNum();

                printf( "R%dC%d", row, col );
        }
    }

   // toLetters( 740 );

    //printf( "%d\n", myPow(4,1) );
//    printf( "%d\n", numberOfLetters(702) );

  return 0;
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

	int where_golbang = 0;
	for (int g = 0; g < idx; g++) {
		while (change[g] != '@') {
			where_golbang++;
			break;
		}
	}
	int start_golbang = where_golbang;
	for (start_golbang ; start_golbang<5; start_golbang++) {
		if (idx == 1&&change[0]=='@') {
			change[0] = change[1] - 1;
			change[1] = 0;
			break;
		}
		if (64 < change[start_golbang] && change[start_golbang] < 91 && change[start_golbang - 1] == '@') {
			change[start_golbang]--;
			change[start_golbang - 1] = 90;
		}
		if (change[start_golbang] == '@') {
			change[start_golbang + 1] = 0;
			change[start_golbang] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

int copy_idx = 0;
	int where_golbangs[10] = { 0 }; int where_gol_idx = 0;
	while (copy_idx != idx) {
		for (int golbang = 0; golbang < idx; golbang++) {
			if (change[golbang] == '@') {
				where_golbangs[where_gol_idx] = golbang;
				where_gol_idx++;
			}
		}
		for (int change_gol = 0; change_gol < where_gol_idx; change_gol++) {
			change[where_golbangs[change_gol]] = 'Z';
			change[where_golbangs[change_gol] + 1] -= 1;
			if (where_golbangs[change_gol] + 1 == idx&& change[where_golbangs[change_gol] + 1]+1=='A')
				change[where_golbangs[change_gol] + 1] = 0;
		}
		where_gol_idx = 0;
		for (int clean = 0; clean < 10; clean++)
			where_golbangs[clean] = 0;
		copy_idx++;
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}
	for (int i = 1; i<idx; i++) {
		if (64 < change[i] && change[i] < 91 && change[i - 1] == '@') {
			change[i]--;
			change[i - 1] = 90;
		}
		if (change[i] == '@') {
			change[i + 1] = 0;
			change[i] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

	int where_golbang = 0;
	for (int g = 0; g < idx; g++) {
		while (change[g] != '@') {
			where_golbang++;
			break;
		}
	}
	int start_golbang = where_golbang;
	for (start_golbang ; start_golbang<5; start_golbang++) {
		if (64 < change[start_golbang] && change[start_golbang] < 91 && change[start_golbang - 1] == '@') {
			change[start_golbang]--;
			change[start_golbang - 1] = 90;
		}
		if (change[start_golbang] == '@') {
			change[start_golbang + 1] = 0;
			change[start_golbang] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };//확인할 좌표

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;//test 수
	int box_idx = 0;
	char change[10] = { 0 };

	FILE* input = fopen("spreadsheet.inp", "rt");
	FILE* output = fopen("spreadsheet.out", "wt");

	fscanf(input, "%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			tmp = fgetc(input);
			if (tmp == '\n'|| tmp == -1) {
				/*for (int i = 0; i < box_idx; i++)
					box[i] = 0;
				box_idx = 0;*/
				//input파일의 한줄이 완료 되면 사용
				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}//box배열에 좌표를 넣는다
		if (box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '7' || box[1] == '8' || box[1] == '9') {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}//C의 인덱스 번호 찾는다
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;//C의 자릿수
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}//C숫자
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				fprintf(output, "%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}//R숫자
			fprintf(output, "%d\n", row);
			C_idx = 0; cnt = 0;
		}//ex) R23C55 인 경우

		else {
			int alpha_idx = 0;//알파벳이 몇까지 있는지 알 수 잇
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}//알파벳이 몇까지 잇는가
			int cipher = alpha_idx - 1;//영어가 몇자리 차지하나?
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}//숫자가 몇까지 잇는가
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			fprintf(output, "R%d", num_result);
			fprintf(output, "C%d\n", result);
		}//ex) BC23 인 경우
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}//test

	fclose(input); fclose(output);

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}
	for (int i = 1; i<idx; i++) {
		if (64 < change[i] && change[i] < 91 && change[i - 1] == '@') {
			change[i]--;
			change[i - 1] = 90;
		}
		if (change[i] == '@') {
			change[i + 1] = 0;
			change[i] = 90;
		}
	}
}//26진수로 변환

void to_10(char box[]) {
	int alpha_idx = 0;//알파벳이 몇까지 있는지 알 수 잇
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}//알파벳이 몇까지 잇는가
	int cipher = alpha_idx - 1;//영어가 몇자리 차지하나?
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}//10진수로 변환


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	FILE* input = fopen("spreadsheet.inp", "rt");
	FILE* output = fopen("spreadsheet.out", "wt");

	fscanf(input, "%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			tmp = fgetc(input);
			if (tmp == '\n'|| tmp == -1) {
				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
		if (box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '7' || box[1] == '8' || box[1] == '9') {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				fprintf(output, "%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			fprintf(output, "%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			fprintf(output, "R%d", num_result);
			fprintf(output, "C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	fclose(input); fclose(output);

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}
	for (int i = 1; i<idx; i++) {
		if (64 < change[i] && change[i] < 91 && change[i - 1] == '@') {
			change[i]--;
			change[i - 1] = 90;
		}
		if (change[i] == '@') {
			change[i + 1] = 0;
			change[i] = 90;
		}
	}
}
void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

	int where_golbang = 0;
	for (int g = 0; g < idx; g++) {
		while (change[g] != '@') {
			where_golbang++;
			break;
		}
	}
	int start_golbang = where_golbang;
	for (start_golbang ; start_golbang<5; start_golbang++) {
		if (idx == 1) {
			change[0] = change[1] - 1;
			change[1] = 0;
			break;
		}
		if (64 < change[start_golbang] && change[start_golbang] < 91 && change[start_golbang - 1] == '@') {
			change[start_golbang]--;
			change[start_golbang - 1] = 90;
		}
		if (change[start_golbang] == '@') {
			change[start_golbang + 1] = 0;
			change[start_golbang] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

	int where_golbang = 0;
	for (int g = 0; g < idx; g++) {
		while (change[g] != '@') {
			where_golbang++;
			break;
		}
	}
	int start_golbang = where_golbang;
	for (start_golbang ; start_golbang<5; start_golbang++) {
		if (idx == 1&&change[0]=='@') {
			change[0] = 'Z';
			change[1] -= 1;
			break;
		}
		if (64 < change[start_golbang] && change[start_golbang] < 91 && change[start_golbang - 1] == '@') {
			change[start_golbang]--;
			change[start_golbang - 1] = 90;
		}
		if (change[start_golbang] == '@') {
			change[start_golbang + 1] = 0;
			change[start_golbang] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

	int where_golbang = 0;
	for (int g = 0; g < idx; g++) {
		while (change[g] != '@') {
			where_golbang++;
			break;
		}
		if (change[g] == 64) {

			break;
		}
	}
	int start_golbang = where_golbang;
	for (start_golbang ; start_golbang<5; start_golbang++) {
		if (idx == 1&&change[0]=='@') {
			change[0] = 'Z';
			change[1] -= 1;
			break;
		}
		if (64 < change[start_golbang] && change[start_golbang] < 91 && change[start_golbang - 1] == '@') {
			change[start_golbang]--;
			change[start_golbang - 1] = 90;
		}
		if (change[start_golbang] == '@') {
			change[start_golbang + 1] = 0;
			change[start_golbang] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}

	int where_golbang = 0;
	for (int g = 0; g < idx; g++) {
		while (change[g] != '@') {
			where_golbang++;
			break;
		}
		if (change[g] == 64) {

			break;
		}
	}
	int start_golbang = where_golbang+1;
	for (start_golbang ; start_golbang<5; start_golbang++) {
		if (idx == 1&&change[0]=='@') {
			change[0] = 'Z';
			change[1] -= 1;
			break;
		}
		if (64 < change[start_golbang] && change[start_golbang] < 91 && change[start_golbang - 1] == '@') {
			change[start_golbang]--;
			change[start_golbang - 1] = 90;
		}
		if (change[start_golbang] == '@') {
			change[start_golbang + 1] = 0;
			change[start_golbang] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
			int find_start = box_idx; int find_alpha = 0;
		for (find_start; find_start > -1; find_start--) {
			if (65 < box[find_start] && box[find_start] < 91) {
				find_alpha++;
			}
		}
		if ((box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '6' || box[1] == '7' || box[1] == '8' || box[1] == '9')&&find_alpha==2) {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}
	for (int i = 1; i<idx; i++) {
		if (64 < change[i] && change[i] < 91 && change[i - 1] == '@') {
			change[i]--;
			change[i - 1] = 90;
		}
		if (change[i] == '@') {
			change[i + 1] = 0;
			change[i] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}


#include<stdio.h>

char box[3000000] = { 0 };

void to_eng(int, char[]);
void to_10(char[]);

int main() {
	int n;
	int box_idx = 0;
	char change[10] = { 0 };

	scanf("%d ", &n);
	for (int n_start = 0; n_start < n; n_start++) {
		for (int box_start = 0;; box_start) {
			char tmp;
			scanf("%c",&tmp);
			if (tmp == '\n'|| tmp == -1) {

				box[box_idx] = '*';
				break;
			}
			else {
				box[box_idx] = tmp;
				box_idx++;
			}
		}
		if (box[1] == '0' || box[1] == '1' || box[1] == '2' || box[1] == '3' || box[1] == '4' || box[1] == '5' ||
			box[1] == '7' || box[1] == '8' || box[1] == '9') {
			int C_idx; int cnt = 0;
			for (int a = 0; a < box_idx; a++) {
				if (box[a] == 'C') {
					C_idx = a;
					break;
				}
			}
			int store_C_idx = C_idx;
			while (box[store_C_idx] != '*') {
				cnt++;
				store_C_idx++;
			}
			cnt--;
			store_C_idx = C_idx + 1;
			int colunm = 0;
			while (box[store_C_idx] != '*') {
				int mul = 1; int cal;
				int num = box[store_C_idx] - 48;
				for (int i = 1; i < cnt; i++)
					mul *= 10;
				cal = num * mul;
				colunm += cal;
				cnt--;
				store_C_idx++;
			}
			store_C_idx = 0;
			cnt = 0;
			to_eng(colunm, change);
			colunm = 0;
			int change_idx = 0;
			for (int i = 0;; i++) {
				if (change[i] != 0)
					change_idx++;
				else {
					change_idx--;
					break;
				}
			}
			while (change_idx != -1) {
				printf("%c", change[change_idx]);
				change_idx--;
			}change_idx = 0;

			int store_R_idx = 1; int row = 0;
			while (box[store_R_idx] != 'C') {
				int mul = 1; int mul_i = store_R_idx; int cal;
				int num = box[store_R_idx] - 48;
				for (mul_i; mul_i < C_idx-1; mul_i++)
					mul *= 10;
				cal = num * mul;
				row += cal;
				cnt--;
				store_R_idx++;
			}
			printf("%d\n", row);
			C_idx = 0; cnt = 0;
		}

		else {
			int alpha_idx = 0;
			for (int i = 0;; i++) {
				if (64 < box[i] && box[i] < 91)
					alpha_idx++;
				else
					break;
			}
			int cipher = alpha_idx - 1;
			int mul = 1; int cal; int result = 0;
			for (int i = 0; i < alpha_idx; i++) {
				for (int j = 0; j < cipher; j++)
					mul *= 26;
				cal = (box[i] - 64) * mul;
				result += cal;
				cipher--;
				mul = 1;
			}
			int num_cnt = 0; int nn = alpha_idx;
			for (nn;; nn++) {
				if (box[nn] != '*')
					num_cnt++;
				else
					break;
			}
			int num_idx = alpha_idx;
			int num_mul=1; int num_cal; int num_result=0;
			while (box[num_idx] != '*') {
				for (int z = 1; z < num_cnt; z++)
					num_mul *= 10;
				num_cal = (box[num_idx]-48) * num_mul;
				num_result += num_cal;
				num_cnt--;
				num_idx++;
				num_mul = 1;
			}
			printf("R%d", num_result);
			printf("C%d\n", result);
		}
		for (int i = 0; i < box_idx+1; i++)
			box[i] = 0;
		box_idx = 0;
		for (int c = 0; c < 10; c++) {
			change[c] = '\0';
		}
	}

	return 0;
}

void to_eng(int num, char change[]) {
	int idx = 0;
	while (num != 0) {
		if (num > 26) {
			change[idx] = num % 26 + 64;
			num /= 26;
			idx++;
		}
		else {
			change[idx] = num + 64;
			break;
		}
	}
	for (int i = 1; i<idx; i++) {
		if (64 < change[i] && change[i] < 91 && change[i - 1] == '@') {
			change[i]--;
			change[i - 1] = 90;
		}
		if (change[i] == '@') {
			change[i + 1] = 0;
			change[i] = 90;
		}
	}
}

void to_10(char box[]) {
	int alpha_idx = 0;
	for (int i = 0;; i++) {
		if (64 < box[i] && box[i] < 91)
			alpha_idx++;
		else
			break;
	}
	int cipher = alpha_idx - 1;
	int mul = 1; int cal; int result = 0;
	for (int i = 0; i < alpha_idx; i++) {
		for (int j = 0; j < cipher; j++)
			mul *= 26;
		cal = (box[i] - 64) * mul;
		result += cal;
		cipher--;
		mul = 1;
	}
}