class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

m.w = h
m.q = h
m.o = a
m.z = j
h.y = a
j.t = a
j.w = b
j.z = h
a.t = b
a.r = h
a.z = k
a.w = k
a.u = k
k.q = j
b.w = h
b.q = h
b.o = a
b.z = j
assert k.q.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

m.w = h
m.q = h
m.o = a
m.z = j
h.y = a
j.t = a
j.w = b
j.z = h
a.t = b
a.r = h
a.z = k
a.w = k
a.u = k
k.q = j
b.w = h
b.q = h
b.o = a
b.z = j
assert k.q.w.o.txt == "a"