import java.util.*;
import java.io.*;

public class Problem_1 {

    public static void main(String[] args) {

        try {
            //System.out.println("Stated");
            Scanner file = new Scanner(new File("C:\\Users\\Tony\\Desktop\\DATA11.txt"));

            while(file.hasNextLine()) {

                ArrayList<String> list = new ArrayList<String>();

                for (int l = 0; l < 9; l++) {
                    list.add(file.nextLine());
                }

                String[][] array = new String[3][3];

                array[0][0] = list.get(0);
                array[0][1] = list.get(1);
                array[0][2] = list.get(2);
                array[1][0] = list.get(3);
                array[1][1] = list.get(4);
                array[1][2] = list.get(5);
                array[2][0] = list.get(6);
                array[2][1] = list.get(7);
                array[2][2] = list.get(8);

                int blanks = 0, one=0, two=0, five=0, ten=0, fifty=0, hundred=0, thousand=0, tenThou=0, fiveHunThou=0, million=0;

                boolean nonePossible = false;

                for (int r = 0; r < 3; r++) {
                    for (int c = 0; c < 3; c++) {
                        if (array[r][c].equals("$1")) one++;
                        if (array[r][c].equals("$2")) two++;
                        if (array[r][c].equals("$5")) five++;
                        if (array[r][c].equals("$10")) ten++;
                        if (array[r][c].equals("$50")) fifty++;
                        if (array[r][c].equals("$100")) hundred++;
                        if (array[r][c].equals("$1000")) thousand++;
                        if (array[r][c].equals("$10000")) tenThou++;
                        if (array[r][c].equals("$500000")) fiveHunThou++;
                        if (array[r][c].equals("$1000000")) million++;
                        if (array[r][c].equals("?")) blanks++;
                    }
                }

                if (one > 2 || two > 2 || five > 2 || ten > 2 || fifty > 2 || hundred > 2 || thousand > 2 || tenThou > 2 || fiveHunThou > 2 || million > 2) {
                    if (one > 2) System.out.println("$1");
                    if (two > 2) System.out.println("$2");
                    if (five > 2) System.out.println("$5");
                    if (ten > 2) System.out.println("$10");
                    if (fifty > 2) System.out.println("$50");
                    if (hundred > 2) System.out.println("$100");
                    if (thousand > 2) System.out.println("$1000");
                    if (tenThou > 2) System.out.println("$10000");
                    if (fiveHunThou > 2) System.out.println("$500000");
                    if (million > 2) System.out.println("$1000000");
                }
                else {

                    if (blanks > 2) System.out.print("$1 $2 $5 $10 $50 $100 $1000 $10000 $500000 $1000000");
                    else if (blanks == 2) {

                        if (one > 0) System.out.print("$1 ");
                        if (two > 0) System.out.print("$2 ");
                        if (five > 0) System.out.print("$5 ");
                        if (ten > 0) System.out.print("$10 ");
                        if (fifty > 0) System.out.print("$50 ");
                        if (hundred > 0) System.out.print("$100 ");
                        if (thousand > 0) System.out.print("$1000 ");
                        if (tenThou > 0) System.out.print("$10000 ");
                        if (fiveHunThou > 0) System.out.print("$500000 ");
                        if (million > 0) System.out.print("$1000000 ");

                        if ((one + two + five + ten + fifty + hundred + thousand + tenThou + fiveHunThou + million) == 0) {
                            nonePossible = true;
                        }
                    }
                    else if (blanks == 1) {

                        if (one > 1) System.out.print("$1 ");
                        if (two > 1) System.out.print("$2 ");
                        if (five > 1) System.out.print("$5 ");
                        if (ten > 1) System.out.print("$10 ");
                        if (fifty > 1) System.out.print("$50 ");
                        if (hundred > 1) System.out.print("$100 ");
                        if (thousand > 1) System.out.print("$1000 ");
                        if (tenThou > 1) System.out.print("$10000 ");
                        if (fiveHunThou > 1) System.out.print("$500000 ");
                        if (million > 1) System.out.print("$1000000 ");

                        if (one < 2 && two < 2 && five < 2 && ten < 2 && fifty < 2 && hundred < 2 && thousand < 2 && tenThou < 2 && fiveHunThou < 2 && million < 2) {
                            nonePossible = true;
                        }
                    }
                    else if (blanks == 0) {

                        if (one > 2) System.out.print("$1 ");
                        if (two > 2) System.out.print("$2 ");
                        if (five > 2) System.out.print("$5 ");
                        if (ten > 2) System.out.print("$10 ");
                        if (fifty > 2) System.out.print("$50 ");
                        if (hundred > 2) System.out.print("$100 ");
                        if (thousand > 2) System.out.print("$1000 ");
                        if (tenThou > 2) System.out.print("$10000 ");
                        if (fiveHunThou > 2) System.out.print("$500000 ");
                        if (million > 2) System.out.print("$1000000 ");

                        if (one < 3 && two < 3 && five < 3 && ten < 3 && fifty < 3 && hundred < 3 && thousand < 3 && tenThou < 3 && fiveHunThou < 3 && million < 3) {
                            nonePossible = true;
                        }
                    }

                    if (!nonePossible) System.out.println();
                    else System.out.println("No Prizes Possible");
                }

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}