A spreadsheet is an interactive computer program for organizing and analyzing data in tabular form. The program operates on data represented as cells of an array, organized in rows and columns. A cell reference in A1 style consists of one or more uppercase letters to identify the column (starting at column A) followed by a row number (starting at row 1). The alternative R1C1 reference style consists of the letter R, the row number, the letter C, and the column number. Row and column numbers both start at 1. Most current spreadsheets use the A1 style, some providing the R1C1 style as a compatibility option.

Microsoft Excel
Microsoft Excel 2010 running on Windows 7

The numeration of columns in the A1 reference style works as follows. The first column is numbered A, the second is numbered B, until column 26 which is numbered Z. Then there are two-letter notations: column 27 is numbered AA, column 28 is numbered AB, column 52 is numbered AZ, column number 53 is numbered BA, and so on. After ZZ we get three-letter notations, after ZZZ we get four-letter notations, and so on.

Visicalc1 was the first electronic spreadsheet on a microcomputer, and it helped turn the Apple II computer into a popular and widely used system. Lotus 1-2-32 was the leading spreadsheet when DOS was the dominant operating system. Excel now has the largest market share on Windows and Macintosh platforms.

Input

The first line of input contains a number $$t \in \mathbb{N}$$ that indicates the number of spreadsheet cell references that are given. This is followed by $$t$$ lines, each containing a cell reference. Cell references either are given in A1 style or in R1C1 style.

Output

Convert each of the given cell references to its alternative notation.

Example

Input:

3
ZY5
R23C55
BC23

Output:

R5C701
BC23  
R23C55