class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: B = None
        self.txt = txt

l = A("l")
n = B("n")
i = C("i")
m = B("m")
d = B("d")
c = B("c")
f = A("f")
j = A("j")
h = C("h")
g = C("g")

l.x = n
n.y = f
n.t = i
i.y = h
i.p = n
m.y = f
m.t = i
d.y = l
d.t = h
c.y = l
c.t = i
f.x = c
j.x = d
h.y = i
h.p = m
g.y = h
g.p = n
assert i.p.t.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: B = None
        self.txt = txt

l = A("l")
n = B("n")
i = C("i")
m = B("m")
d = B("d")
c = B("c")
f = A("f")
j = A("j")
h = C("h")
g = C("g")

l.x = n
n.y = f
n.t = i
i.y = h
i.p = n
m.y = f
m.t = i
d.y = l
d.t = h
c.y = l
c.t = i
f.x = c
j.x = d
h.y = i
h.p = m
g.y = h
g.p = n
assert i.p.t.p.t.p.txt == "n"