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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: D = None
        self.q: A = None
        self.s: D = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.x: 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.o: D = None
        self.t: A = None
        self.p: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: D = None
        self.q: A = None
        self.s: D = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.x: 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.o: D = None
        self.t: A = None
        self.p: A = None
        self.txt = txt

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

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