import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class One extends HttpServlet {

    int[] cards = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
                   8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14} ;
    String cardS = "";

    public void doGet(HttpServletRequest request,
		      HttpServletResponse response)
	throws ServletException,
	       IOException {

        String message = request.getParameter("message");
	response.setContentType("text/html");
	PrintWriter out = response.getWriter();
        if (message == null) {

            cardS  = "";

            for (int i = 0; i < 100; i++) {
                int a = (int) (Math.random() * cards.length);
                int b = (int) (Math.random() * cards.length);
                int temp = cards[a];
                cards[a] = cards[b];
                cards[b] = temp;
            }

            for (int i = 0; i < cards.length; i++)
                cardS += cards[i] + " ";
        } else {

            cardS = request.getParameter("cards");
            StringTokenizer st = new StringTokenizer(cardS);

            if (st.countTokens() > 0) {

                String t1 = st.nextToken(), t2= st.nextToken();

                message = "( " + t1 + ", " + t2 + ")";

                cardS = "";
                while (st.hasMoreTokens()) {
                    cardS = cardS + " " + st.nextToken();
                }

            } else {

                cardS  = "";

                for (int i = 0; i < 100; i++) {
                    int a = (int) (Math.random() * cards.length);
                    int b = (int) (Math.random() * cards.length);
                    int temp = cards[a];
                    cards[a] = cards[b];
                    cards[b] = temp;
                }

                for (int i = 0; i < cards.length; i++)
                    cardS += cards[i] + " ";

            }

        }

	out.println(
"<form method=GET>" +
message + "<p> " + cardS +
"  <input type=\"hidden\" name=\"message\" value=\"welcome\"> " +
"  <input type=\"hidden\" name=\"cards\" value=\"" + cardS + "\">" +
"  <p> <input type=\"submit\" value=\"Proceed\">" +
"</form>"

        );

    }
}