#include <iostream>
#include <string>
#include <utility>
#include <queue>
#include <fstream>
int main()
{
std::ifstream in_file( "input.txt" ) ;
// the queue contains pairs: each pair having an int and a string
// https://en.cppreference.com/w/cpp/utility/pair
std::queue< std::pair<int,std::string> > q ;
int number ;
std::string text ;
while( in_file >> number >> text ) // for each pair read from the file
q.emplace( number, text ) ; // place it into the queue (construct the pair in-situ)
// https://en.cppreference.com/w/cpp/container/queue/emplacewhile( !q.empty() )
{
constauto& pair = q.front() ;
std::cout << pair.first << ' ' << pair.second << '\n' ;
/* or in C++17 (structured binding)
const auto [ num, txt ] = q.front() ;
std::cout << num << ' ' << txt << '\n' ;
*/
q.pop() ;
}
}