using static System.Console;
public class Program {
public static void Main() {
var A1 = ReadLine();
var A2 = ReadLine();
var A3 = ReadLine();
var A4 = ReadLine();
var A5 = ReadLine();
var A6 = ReadLine();
var A7 = ReadLine();
var A8 = ReadLine();
Write($"Segunda: {A1}, {A2}, {A3}, {A4}");
ReadLine();
Write($"Terça: {A5}, {A8}, {A6}, {A2}, {A7}");
}