#include <algorithm>
#include <iostream>
#include <vector>

int main() {
	const int MAX_INPUT = 10;
	const int INPUT = 2;
	
    std::string symbols = "0123456789";
    
    std::vector<int> symbolChooseTable(MAX_INPUT-INPUT, 0);
    std::vector<int> allOnes(INPUT, 1);
    symbolChooseTable.insert(symbolChooseTable.end(), allOnes.begin(), allOnes.end());
    
    auto GetSelectedSymbols = [&symbols, &symbolChooseTable]()
    {
    	std::string selectedSymbol;
    	for (size_t i = 0; i<symbolChooseTable.size(); ++i)
    	{
    		if (symbolChooseTable[i])
    		{
    			selectedSymbol += symbols[i];
    		}
    	}
    	return selectedSymbol;
    };
 	
 	do
 	{
 		auto selectedSymbols = GetSelectedSymbols();
 		do
 		{
 			std::cout << selectedSymbols << "\n";
 		} while (std::next_permutation(selectedSymbols.begin(), selectedSymbols.end()));
 	} while (std::next_permutation(symbolChooseTable.begin(), symbolChooseTable.end()));
    
	return 0;
}