Teaching a Pokémon a new move needs a hidden machine or a technical machine.
There are 8 hidden machines, HM01 to HM08, and 50 technical machines, TM01 to TM50.
Given a list of machines, write a program that finds the numbers of the Pokémon that can learn every move on the list.
Assume that only the Pokémon from number 1, Bulbasaur, to number 151, Mew, exist.
The first line contains the number of moves N (1≤N≤58).
Each of the next N lines contains one move name. A hidden machine is written as HM01 and a technical machine as TM01.
On the first line, print the numbers of the Pokémon that can learn every given move in ascending order, separated by single spaces.
The data follows Pokémon FireRed Version and uses the generation 3 move list at https://pokemondb.net/pokedex/bulbasaur/moves/3.