406753: GYM102535 J Aufbau

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Aufbautime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are a student of the Academy for Covert Missions, currently not doing your chemistry homework. Now, chemistry can be useful to secret agents in many ways – gunpowder, smoke bombs, poison – but you don't care about any of that. You want to be a Hacker Agent, the enigmatic guy in the hoodie watching various UI elements pop up on the screen, the guy spewing technical terms while rapidly hacking on the back of a speeding motorcycle. That's why you're going to make a computer program to do your homework for you!

An atom has one or more electron shells, and each shell itself has one or more subshells. The electrons of an atom are distributed across its different shells within the different subshells. The Aufbau Principle dictates how these electrons are distributed, which is called its electron configuration.

An example electron configuration is that of Oxygen (O), which is $$$1s^2$$$ $$$2s^2$$$ $$$2p^4$$$. This means:

  • in the first shell, there are 2 electrons in the zeroth subshell
  • in the second shell, there are 2 electrons in the zeroth subshell, and 4 electrons in the first subshell

As in the example, the electron configuration of an element is represented by a series of terms of the form $$$nl^e$$$, where:

  • $$$n$$$ - a positive integer, representing the electron shell
  • $$$\ell$$$ - a non-negative integer, representing the "position" the subshell
  • $$$l$$$ - a letter, which by convention we use instead of $$$\ell$$$ to depict the subshell
  • $$$e$$$ - a positive integer, representing the number of electrons held by the shell

The corresponding letters/labels for each subshell are:

$$$$$$\begin{array}{|r|rrrr|} \hline \ell & 0 & 1 & 2 & 3 \\ \hline l & s & p & d & f \\ \hline \end{array}$$$$$$

Each shell of an atom has a maximum number of subshells – in fact, the $$$n$$$th shell can have up to $$$n$$$ subshells (thus, $$$0 \leq \ell < n$$$, always).

Each subshell of an atom has a maximum "capacity" – in other words, it can only fit a specific number of electrons. This capacity is determined solely by its $$$l$$$, in particular: $$$2(2\ell + 1)$$$. Thus, the $$$3p$$$ subshell can fit $$$2(2\cdot1 + 1) = 6$$$ electrons, the $$$2p$$$ subshell can also fit $$$6$$$ electrons, while the $$$4d$$$ subshell can fit $$$2(2\cdot2 + 1) = 10$$$ electrons.

The Aufbau Principle states that the electrons of an atom fill up subshells (to their capacity) in order of increasing $$$n + \ell$$$, and in ties, by increasing $$$n$$$, as illustrated in this diagram:

For example, Hydrogen, with 1 electron, fills the zeroth subshell in the first shell with its lone electron. Thus, its electron configuration is $$$1s^1$$$. Helium, with 2 electrons, will fill the zeroth subshell with both of its electrons, making its configuration $$$1s^2$$$. Lithium, with 3 electrons, will fill up the zeroth subshell in the first shell, then fill the first subshell in the second shell, making it $$$1s^2$$$ $$$2s^1$$$. Potassium, the 19th element and thus 19 electrons, will have the following configuration: $$$1s^2$$$ $$$2s^2$$$ $$$2p^6$$$ $$$3s^2$$$ $$$3p^6$$$ $$$4s^1$$$.

Seeing this pattern, you figure out that you could make a simple program for this. You can even generalize it to the $$$10^{15}$$$th element! You hope that there are no exceptions to the Aufbau Principle. (Spoiler: there are, but you don't really care enough about chemistry to address them.) Also, for $$$\ell > 3$$$, you're not really sure what happens, but you are just going to assume that the rest of the alphabet after 'f' (excluding 's' and 'p') will be used. That is, we will use the following extended table of levels: $$$$$$ \begin{array}{|r|rrrrrrrrrr} \hline \ell & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & \ldots \\ \hline l & s & p & d & f & g & h & i & j & k & \ldots \\ \hline \end{array}

$$$$$$ Remember that 's' and 'p' are skipped.

Once you reach 'z', you will use two-letter labels without skipping any letters this time. Specifically, you will use all possible two-letter combinations in lexicographical order (aa, ab, ac, ..., az, ba, bb, ..., ca, ..., zz).

After 'zz', all three-letter combinations (aaa, aab, ..., zzz) will be used as labels, and so on.

You therefore "extend" the pattern as follows:

Now, given an atomic number (which is the same as its number of electrons), can you find the last electron shell, last subshell and number of electrons in the last shell in its electron configuration? In other words, what is the last "$$$nl^e$$$"? For example, if the given atomic number is $$$19$$$, then the answer should be $$$4s^1$$$.

Output the answer as $$$n$$$, $$$l$$$, $$$e$$$ in a single line NOT separated by spaces. For example, for $$$19$$$, output 4s1.

Input

The first line of input contains $$$t$$$, the number of test cases. $$$t$$$ test cases follow.

Each test case is composed of a single line containing an integer $$$a$$$ denoting an atomic number.

Constraints

$$$1 \leq t \leq 10^5$$$

$$$1 \leq a \leq 10^{15}$$$

Output

For each test case, output a single line containing $$$n$$$, $$$l$$$ and $$$e$$$, NOT separated by spaces. For example, for $$$19$$$, output 4s1.

ExampleInput
3
19
103
1000000000000000
Output
4s1
6d1
93591dzil31704

加入题单

算法标签: