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

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

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

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

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

k = A("k")
b = B("b")
l = C("l")
f = D("f")
m = E("m")
g = E("g")
a = C("a")
i = E("i")

k.t = f
b.p = m
b.z = m
b.v = k
l.t = b
l.z = f
f.o = g
m.z = a
m.o = i
g.z = l
g.o = i
a.t = b
a.z = f
i.z = l
i.o = g
assert f.o.z.t.p.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

k = A("k")
b = B("b")
l = C("l")
f = D("f")
m = E("m")
g = E("g")
a = C("a")
i = E("i")

k.t = f
b.p = m
b.z = m
b.v = k
l.t = b
l.z = f
f.o = g
m.z = a
m.o = i
g.z = l
g.o = i
a.t = b
a.z = f
i.z = l
i.o = g
assert f.o.z.t.p.z.z.txt == "f"