import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.TimeZone;
import java.util.TreeMap;

public class TzNameTestB {
    TzNameTestB(String[] tzNames) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy MM dd zzz");
        DateTimeFormatter dtfv = DateTimeFormatter.ofPattern("yyyy MM dd zzz ZZZZ HH:mm");
        int year = ZonedDateTime.now().getYear();
        if (System.getProperty("zdt.year") != null) {
            try {
                year = Integer.parseInt(System.getProperty("zdt.year"));
            } catch (NumberFormatException nfe) {
            }
        }
        for (String tzName : tzNames) {
            TimeZone tz = TimeZone.getTimeZone(tzName);
            ZoneId zid = tz.toZoneId();
            System.out.println(tzName);
            ZonedDateTime zdt = ZonedDateTime.of(
                    year, 1, 1, 0, 0, 0, 0, zid);
            ZonedDateTime zdtMax = zdt.plusYears(1);
            TreeMap<String, Integer> map = new TreeMap<>();
            while (zdt.isBefore(zdtMax)) {
                String s = dtf.format(zdt);
                if (map.containsKey(s)) {
                    map.put(s, map.get(s) + 1);
                } else {
                    map.put(s, 1);
                }
                zdt = zdt.plusHours(1);
            }
            for (String s : map.keySet().toArray(new String[0])) {
                if (map.get(s) != 24) {
                    System.out.println("["+s + " " + map.get(s)+"]");
                    try {
                        String[] sa = s.split(" ");
                        zdt = ZonedDateTime.of(year, 1, 1, 0, 0, 0, 0, zid);
                        int month = Integer.parseInt(sa[1]);
                        int day = Integer.parseInt(sa[2]);
                        zdt = zdt.plusMonths(month - 1);
                        zdt = zdt.plusDays(day - 1);
                        String sv = dtfv.format(zdt);
                        String sd = sa[0]+" "+sa[1]+" "+sa[2];
                        while (sv.startsWith(sd)) {
                            System.out.println(sv);
                            zdt = zdt.plusHours(1);
                            sv = dtfv.format(zdt);
                        }
                    } catch (NumberFormatException nfe) {
                    }                    
                } else {
                    map.remove(s);
                }
            }
        }
    }

    public static void main(String[] args) {
        new TzNameTestB(args);
    }
}
