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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

f = A("f")
a = B("a")
i = C("i")
n = D("n")
k = E("k")
h = E("h")
e = C("e")
m = C("m")

f.p = n
f.o = i
a.y = f
a.r = h
i.v = f
n.x = m
k.z = f
k.t = n
k.o = h
h.z = f
h.t = n
h.o = k
e.v = f
m.v = f
assert a.r.o.o.o.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

f = A("f")
a = B("a")
i = C("i")
n = D("n")
k = E("k")
h = E("h")
e = C("e")
m = C("m")

f.p = n
f.o = i
a.y = f
a.r = h
i.v = f
n.x = m
k.z = f
k.t = n
k.o = h
h.z = f
h.t = n
h.o = k
e.v = f
m.v = f
assert a.r.o.o.o.o.z.txt == "f"