using System.Collections.Generic;
public string Name { get; set; }
public List<Person> Children { get; set; }
public static void Main(string[] args)
var people = new List<Person> {
Children = new List<Person> {
Children = new List<Person> {
static void ProcessPeople(List<Person> people, string parentName = null) {
for (var i = 0; i < people.Count; i++) {
if (parentName != null) {
if (person.Children != null) {
Console.WriteLine(person.Name + " has a parent of " + parentName + " with children:");
Console.WriteLine(person.Name + " has a parent of " + parentName + " with No children.");
if (person.Children != null) {
Console.WriteLine(person.Name + " has no parent with children:");
Console.WriteLine(person.Name + " has no parent and No children.");
if (person.Children != null) {
ProcessPeople(person.Children, person.Name);