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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: F = None
        self.p: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

f = A("f")
m = B("m")
k = C("k")
i = D("i")
d = E("d")
c = F("c")
g = C("g")
n = D("n")
a = C("a")

f.z = d
f.o = a
m.z = i
k.u = f
k.z = f
i.v = n
i.p = n
i.o = c
d.x = f
c.o = m
g.u = f
g.z = f
n.v = i
n.p = i
n.o = c
a.u = f
a.z = f
assert c.o.z.o.o.z.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: F = None
        self.p: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

f = A("f")
m = B("m")
k = C("k")
i = D("i")
d = E("d")
c = F("c")
g = C("g")
n = D("n")
a = C("a")

f.z = d
f.o = a
m.z = i
k.u = f
k.z = f
i.v = n
i.p = n
i.o = c
d.x = f
c.o = m
g.u = f
g.z = f
n.v = i
n.p = i
n.o = c
a.u = f
a.z = f
assert c.o.z.o.o.z.p.o.txt == "c"