import java.util.Dictionary;

public class Card
{
  private int value;
  private char suit;

  public Card(int val, char suit)
  {
    if(val < 1 || val > 13)
      throw new CardException("Illegal value" + val);
    this.value = val;
    if(suit == 'c')
      suit = 'C';
    if(suit == 'd')
      suit = 'D';
    if(suit == 'h') 
      suit = 'H';
    if(suit == 's')
      suit = 'S';

    if (suit == 'C' || suit == 'D' || suit == 'H' || suit == 'S')
      this.suit = suit;
    else
      throw new CardException("Illegal suit " + suit);
  }

  public int getValue()
  {
    return this.value;
  }

  public int getSuit()
  {
    return this.suit;
  }

  public String toString()
  {
    String suitName = "";
    String valNames[] = {"Joker", "Ace", "Two", "Three", "Four", "Five", "Six", "Seven",
                         "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    if(this.suit == 'C')
      suitName = "Clubs";
    else if (this.suit == 'D')
      suitName = "Diamonds";
    else if (this.suit == 'H')
      suitName = "Hearts";
    else if (this.suit == 'S')
      suitName = "Spades";
    else //should never get here
      System.out.println("Please submit a software performance report");
    
    return "The " + valNames[this.value] + " of " + suitName;
  }

  public static void main(String args[])
  {
    int val = Integer.parseInt(args[0]);
    char suit = args[1].charAt(0);
    Card c = new Card(val, suit);
    System.out.println(c);
  }
}
