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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: E = None
        self.r: B = None
        self.u: D = None
        self.txt = txt

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

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

k = A("k")
c = B("c")
f = C("f")
j = D("j")
n = E("n")

k.q = j
c.o = n
c.p = j
c.q = j
c.s = f
f.p = c
f.r = c
f.q = n
f.u = j
j.x = n
j.t = k
n.z = f
n.p = j
n.o = c
assert k.q.x.z.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: E = None
        self.r: B = None
        self.u: D = None
        self.txt = txt

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

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

k = A("k")
c = B("c")
f = C("f")
j = D("j")
n = E("n")

k.q = j
c.o = n
c.p = j
c.q = j
c.s = f
f.p = c
f.r = c
f.q = n
f.u = j
j.x = n
j.t = k
n.z = f
n.p = j
n.o = c
assert k.q.x.z.u.x.txt == "n"