public static void main(String[] args) throws NumberFormatException,
      IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String temp = null;
    Map<Integer, Deal> dealOptionsMap = new HashMap<Integer, Deal>();
    while ((temp = in.readLine()) != null && temp.length() != 0) {
      String[] input = temp.split(",");
      int dealId = Integer.valueOf(input[0]);
      int option = Integer.valueOf(input[1]);
      if (dealOptionsMap.get(dealId) == null) {
        Deal deal = new Deal(dealId, option);
        dealOptionsMap.put(dealId, deal);
      }
      else {
        Deal deal = dealOptionsMap.get(dealId);
        deal.addOption(option);
      }
    }
    List<Deal> deals = getDealList(dealOptionsMap);
    for (Deal deal : deals) {
      System.out.println(deal);
    }
  }