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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: A = None
        self.y: D = None
        self.v: E = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
b = C("b")
m = D("m")
c = E("c")

h.w = m
j.q = c
j.v = c
j.x = h
j.u = h
j.y = m
b.u = j
m.t = c
m.w = j
m.s = j
m.y = h
m.z = b
c.t = m
c.q = b
c.w = b
c.x = j
assert m.t.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: A = None
        self.y: D = None
        self.v: E = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
b = C("b")
m = D("m")
c = E("c")

h.w = m
j.q = c
j.v = c
j.x = h
j.u = h
j.y = m
b.u = j
m.t = c
m.w = j
m.s = j
m.y = h
m.z = b
c.t = m
c.q = b
c.w = b
c.x = j
assert m.t.w.u.v.txt == "c"