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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: D = None
        self.t: E = None
        self.y: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: D = None
        self.t: E = None
        self.y: C = None
        self.x: B = None
        self.txt = txt

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

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

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