import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Scanner in = new Scanner(System.in);
        String str1 = in.nextLine();

        //write your code here......
        String[] bj = str1.split(" ");
        if (bj.length != 6) {
            System.out.println("您输入的数据不合理");
        } else {
            String str = bj[0] + "-" + bj[1] + "-" + bj[2] + " " + bj[3] + ":" + bj[4] + ":"
                         + bj[5];
            Date date = sdf.parse(str);
            System.out.println("北京时间为:" + sdf.format(
                                   date.getTime())); //格式化后输出
            System.out.println("纽约时间为:" + sdf.format(date.getTime() -
                               (long) 12 * 60 * 60 * 1000)); //减去12h
        }



    }
}