1.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
* Angewandte Mathematik, SS11 Problem: 11525 - Permutations Link:
* http://uva.onlinejudge.org/external/4/482.pdf
*
* @author Benedikt Zšnnchen
* @author Erik Wenzel
* @version 1.0, 29/04/2011
*
* Method : Sorting, Ad-hoc
* Status : Accepted
* Runtime: 0.420
*/


public class Main
{

public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int cases = Integer.parseInt(reader.readLine());
StringBuilder builder;

while(cases != 0)
{
cases--;
reader.readLine();
builder = new StringBuilder();
String[] order = reader.readLine().split(" ");
String[] input = reader.readLine().split(" ");

String[] output = new String[input.length];

for(int i = 0; i < order.length; i++)
{
output[Integer.parseInt(order[i])-1] = input[i]+"\n";
}

for (String string : output)
{
builder.append(string);
}

if(cases > 0)
{
builder.append("\n");
}

System.out.print(builder);
}

}
}


2.

/**
* Angewandte Mathematik, SS11
* Problem: 482 - Permutation Arrays
* http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=6&problem=423&mosmsg=Submission+received+with+ID+8880652 * @author Marco Wolff
* @author Christian Weber
* @author Christoph Waldleitner
* @author Marco Wolff
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.484
*/

import java.io.*;

public class Permutation_Arrays
{
public static void main(String[] args) throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int cases = Integer.parseInt(br.readLine());
for(int k = 0; k<cases;k++)
{
br.readLine();
String[] array = br.readLine().split(" ");
String[] numbers = br.readLine().split(" ");
String[] out = new String[array.length];
String output="";

for(int i = 0; i<array.length;i++)
{
int a = Integer.parseInt(array[i])-1;
out[a] = numbers[i];
}
for(int i = 0;i<out.length;i++)
{
output += out[i]+"\n";
}
System.out.print(output);
if(k<cases-1)
System.out.println();
}
}
}



--------------------------------------------------------------------------

1.
/**
 *
 * Problem #482 - Permutation Arrays
 * http://uva.onlinejudge.org/external/4/482.pdf

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted
 * Runtime: 0.028
 */
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define pi acos(-1.0)
#define N 1000000
#define LL long long
using namespace std;

struct array {
    int in;
    string num;
} a [10000];

bool cmp (array x, array y)
{
    if ( x.in < y.in ) return true;
    return false;
}

int main ()
{
    int testCase;
    scanf ("%d", &testCase);
    getchar ();

    bool blank = false;

    while ( testCase-- ) {
        char input [100000];
        gets (input);
        gets (input);

        char *pch = strtok (input, " ");
        int index = 0;

        while ( pch != NULL ) {
            a [index].in = atoi (pch);
            pch = strtok (NULL, " ");
            index++;
        }

        gets (input);

        pch = strtok (input, " ");
        index = 0;

        while ( pch != NULL ) {
            a [index].num = pch;
            pch = strtok (NULL, " ");
            index++;
        }

        sort (a, a + index, cmp);

        if ( blank ) printf ("\n");
        blank = true;

        for ( int i = 0; i < index; i++ )
            cout << a [i].num << endl;
    }

    return 0;
}