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

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

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

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

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

k = A("k")
n = B("n")
a = C("a")
b = D("b")
h = E("h")

k.t = h
n.o = a
a.p = n
a.s = n
a.q = n
b.u = n
h.r = b
h.t = n
h.z = k
assert b.u.o.q.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
a = C("a")
b = D("b")
h = E("h")

k.t = h
n.o = a
a.p = n
a.s = n
a.q = n
b.u = n
h.r = b
h.t = n
h.z = k
assert b.u.o.q.o.p.txt == "n"