require 'date'



LONG_MONTHS = [1,3,5,7,8,10,12]
YEARS       = (1900..2100).to_a

dates    = YEARS.product(LONG_MONTHS).map{|y, m| Date.new(y,m,31)}.select(&:sunday?)
years_4w = YEARS - dates.map(&:year)

puts 
puts dates.first(5).map {|d| d.strftime() }, 
puts dates.last(5).map {|d| d.strftime() }
puts 
puts years_4w.join()