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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: A = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.q: D = None
        self.z: B = None
        self.w: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: A = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.q: D = None
        self.z: B = None
        self.w: D = None
        self.txt = txt

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

a.w = i
c.z = f
c.v = h
c.u = e
c.w = e
e.x = c
e.q = a
h.r = e
h.s = e
h.t = a
h.v = a
k.v = c
k.p = c
k.z = c
k.q = i
k.w = i
f.v = c
f.p = c
f.z = c
f.q = h
f.w = h
i.r = e
i.s = e
i.t = a
i.v = a
assert f.p.u.q.w.v.w.v.txt == "a"