import java.util.Scanner;
public class Exercise06_19 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number of Students: ");
int numberOfStudents = input.nextInt();
String[] name = new String[numberOfStudents];
for (int i = 0; i < name.length; i++) {
name[i] = input.next();//grab the string input values and put into the name array
}
int[] score = new int[numberOfStudents];
for (int i = 0; i < score.length; i++) {
score[i] = input.nextInt();//grab the integer input values and put them in the score array
}
decreasingOrder(name, score);
}
public static void decreasingOrder(String[] name, int[] score) {
for (int i = 0; i < score.length - 1; i++) {
int currentMin = score[i];
int currentMinIndex = i;
String currentMinName = name[i];
for (int j = i + 1; j < score.length; j++) {
if (currentMin > score[j]) {
currentMin = score[j];
currentMinIndex = j;
currentMinName = name[j];//swap the string array values
}
}
if (currentMinIndex != i) {
score[currentMinIndex] = score[i];
score[i] = currentMin;
}
System.out.println(name[i] + score[i]);
}
}
}