using System.Collections.Generic;
public static void Main()
string strYear = Console.ReadLine();
int year = Convert.ToInt32(strYear);
Console.Write("Month: ");
string strMonth= Console.ReadLine();
int month = Convert.ToInt32(strMonth);
var daysInMonth = DateTime.DaysInMonth(year, month);
List<DateTime> list = new List<DateTime>();
for (int day = daysInMonth; day > 0; day--)
DateTime currentDateTime = new DateTime(year, month, day);
if (currentDateTime.DayOfWeek == DayOfWeek.Saturday)
list.Add(currentDateTime);
var result = list.OrderByDescending(d => d.Date).First();
Console.WriteLine(result);