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

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

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

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

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

n = A("n")
e = B("e")
a = C("a")
c = D("c")
k = E("k")

n.t = k
n.q = c
e.x = n
e.v = k
e.p = k
e.r = k
a.z = e
a.t = e
a.y = e
a.w = n
c.z = n
k.v = n
k.z = n
k.t = c
assert k.t.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

n = A("n")
e = B("e")
a = C("a")
c = D("c")
k = E("k")

n.t = k
n.q = c
e.x = n
e.v = k
e.p = k
e.r = k
a.z = e
a.t = e
a.y = e
a.w = n
c.z = n
k.v = n
k.z = n
k.t = c
assert k.t.z.q.txt == "c"