    #include <algorithm>
    #include <vector>
    #include <iostream>
    
    int main()
    {
        int n = 10; 
        std::vector<std::vector<int>> A(2, std::vector<int>(n));
        int val;
        int i;
        while (std::cin >> val && i < 10)
        {
            A[0][i] = val;
            A[1][i] = i;
            ++i;
        }

        // sort the index row, not the "data" row
    	std::sort(A[1].begin(), A[1].end(), 
                  [&](int n1, int n2){ return A[0][n1] < A[0][n2]; });
        // output results
    	for (int i = 0; i < 2; ++i)
    	{
    		for (int j = 0; j < n; ++j)
    		{
    			if (i == 0)  // if this is a data row
    				std::cout << A[i][A[1][j]] << " ";
    			else // this is an index row
    				std::cout << A[i][j] << " ";
    		}
    		std::cout << "\n";
    	}
    }

