import java.io.BufferedReader;
	import java.io.File;
	import java.io.FileNotFoundException;
	import java.io.FileReader;
	import java.io.IOException;
    import java.io.InputStreamReader;

	public class Main {
		public static void main(String[] args) throws FileNotFoundException, IOException {
			try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
				String line;
				next: while ((line = reader.readLine()) != null) {
					String[] split = line.split(" ");
					int num_elements = Integer.parseInt(split[0]);
					int i;
					boolean[] array = new boolean[num_elements - 1];
					for (i = 1; i <= num_elements; i++) {
						int num = Integer.parseInt(split[i]);
						if (i + 1 <= num_elements) {
							int num2 = Integer.parseInt(split[i + 1]);
							double abs = Math.abs(num - num2);
							if (abs - 1 < num_elements - 1) {
								array[(int) (abs - 1)] = true;
							}
						}
						System.out.printf("%d ", num);
					}
					for (int j = 0; j < array.length; j++)
						if (!array[j]) {
							System.out.printf("\tNot Jolly\n");
							continue next;
						}
					System.out.printf("\tJolly\n");
				}
			}
		}
	}