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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.q: D = None
        self.s: D = None
        self.r: C = None
        self.txt = txt

m = A("m")
j = B("j")
g = C("g")
h = D("h")
k = E("k")

m.u = j
m.v = g
j.z = g
j.r = g
j.p = m
j.s = m
j.w = h
g.t = k
g.s = k
g.v = h
g.w = j
h.q = k
h.w = k
h.y = k
h.z = m
k.u = j
k.z = h
k.q = h
k.s = h
k.r = g
assert g.t.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.q: D = None
        self.s: D = None
        self.r: C = None
        self.txt = txt

m = A("m")
j = B("j")
g = C("g")
h = D("h")
k = E("k")

m.u = j
m.v = g
j.z = g
j.r = g
j.p = m
j.s = m
j.w = h
g.t = k
g.s = k
g.v = h
g.w = j
h.q = k
h.w = k
h.y = k
h.z = m
k.u = j
k.z = h
k.q = h
k.s = h
k.r = g
assert g.t.u.w.txt == "h"