{"raw_statement":[{"iden":"statement","content":"The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.\n\nUnfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.\n\nVladimir wants to rename the files with tests so that their names are distinct integers starting from 1 without any gaps, namely, \"_1_\", \"_2_\", ..., \"_n_', where _n_ is the total number of tests.\n\nSome of the files contain tests from statements (examples), while others contain regular tests. It is possible that there are no examples, and it is possible that all tests are examples. Vladimir wants to rename the files so that the examples are the first several tests, all all the next files contain regular tests only.\n\nThe only operation Vladimir can perform is the \"_move_\" command. Vladimir wants to write a script file, each of the lines in which is \"_move file_1 file_2_\", that means that the file \"_file_1_\" is to be renamed to \"_file_2_\". If there is a file \"_file_2_\" at the moment of this line being run, then this file is to be rewritten. After the line \"_move file_1 file_2_\" the file \"_file_1_\" doesn't exist, but there is a file \"_file_2_\" with content equal to the content of \"_file_1_\" before the \"_move_\" command.\n\nHelp Vladimir to write the script file with the minimum possible number of lines so that after this script is run:\n\n*   all examples are the first several tests having filenames \"_1_\", \"_2_\", ..., \"_e_\", where _e_ is the total number of examples;\n*   all other files contain regular tests with filenames \"__e_ + 1_\", \"__e_ + 2_\", ..., \"_n_\", where _n_ is the total number of all tests."},{"iden":"input","content":"The first line contains single integer _n_ (1 ≤ _n_ ≤ 105) — the number of files with tests.\n\n_n_ lines follow, each describing a file with test. Each line has a form of \"_name_i type_i_\", where \"_name_i_\" is the filename, and \"_type_i_\" equals \"_1_\", if the _i_\\-th file contains an example test, and \"_0_\" if it contains a regular test. Filenames of each file are strings of digits and small English letters with length from 1 to 6 characters. The filenames are guaranteed to be distinct."},{"iden":"output","content":"In the first line print the minimum number of lines in Vladimir's script file.\n\nAfter that print the script file, each line should be \"_move file_1 file_2_\", where \"_file_1_\" is an existing at the moment of this line being run filename, and \"_file_2_\" — is a string of digits and small English letters with length from 1 to 6."},{"iden":"examples","content":"Input\n\n5\n01 0\n2 1\n2extra 0\n3 1\n99 0\n\nOutput\n\n4\nmove 3 1\nmove 01 5\nmove 2extra 4\nmove 99 3\n\nInput\n\n2\n1 0\n2 1\n\nOutput\n\n3\nmove 1 3\nmove 2 1\nmove 3 2\n\nInput\n\n5\n1 0\n11 1\n111 0\n1111 1\n11111 0\n\nOutput\n\n5\nmove 1 5\nmove 11 1\nmove 1111 2\nmove 111 4\nmove 11111 3"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}