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

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

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

f = A("f")
m = B("m")
d = C("d")
n = C("n")
c = A("c")
e = A("e")
a = C("a")
b = C("b")
l = B("l")

f.y = n
f.s = b
f.o = d
m.p = e
d.z = e
d.o = l
n.z = e
n.o = l
c.y = n
c.s = d
c.o = a
e.y = n
e.s = n
e.o = n
a.z = e
a.o = l
b.z = f
b.o = m
l.p = c
assert m.p.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: C = None
        self.o: C = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
d = C("d")
n = C("n")
c = A("c")
e = A("e")
a = C("a")
b = C("b")
l = B("l")

f.y = n
f.s = b
f.o = d
m.p = e
d.z = e
d.o = l
n.z = e
n.o = l
c.y = n
c.s = d
c.o = a
e.y = n
e.s = n
e.o = n
a.z = e
a.o = l
b.z = f
b.o = m
l.p = c
assert m.p.y.z.y.txt == "n"