static void Main(string[] args) { int numberOfPeople = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < numberOfPeople; i++) { string[] tokens = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = tokens[0]; int age = int.Parse(tokens[1]); Person person = new Person(name, age); family.AddMember(person); } var filteredMembers = family.GetFilteredMembers(); foreach (var member in filteredMembers) { Console.WriteLine($"{member.Name} - {member.Age}"); } }