
// System.out is so slow... We use StringBuilder.

import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    final Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    while (sc.hasNextInt()) {
      int n = sc.nextInt();
      int b = sc.nextInt();
      // System.out.println(n + " " + b + " " + (Solution.tres_digits_seguits_iguals(n, b) ? 1 : 0));
      sb.append(n + " " + b + " " + (Solution.tres_digits_seguits_iguals(n, b) ? 1 : 0) + "\n");
    }
    System.out.print(sb.toString());
  }

}
