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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: D = None
        self.y: A = None
        self.z: D = None
        self.w: A = None
        self.txt = txt

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

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

k = A("k")
l = B("l")
h = C("h")
c = D("c")
f = E("f")

k.z = l
l.q = f
h.u = k
h.y = k
h.w = k
h.v = c
h.z = c
c.x = l
f.y = k
f.t = h
f.w = h
assert f.y.z.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: D = None
        self.y: A = None
        self.z: D = None
        self.w: A = None
        self.txt = txt

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

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

k = A("k")
l = B("l")
h = C("h")
c = D("c")
f = E("f")

k.z = l
l.q = f
h.u = k
h.y = k
h.w = k
h.v = c
h.z = c
c.x = l
f.y = k
f.t = h
f.w = h
assert f.y.z.q.w.txt == "h"