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

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

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

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

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

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

m.u = f
m.w = h
m.y = g
m.z = g
k.w = m
k.x = m
i.q = h
f.t = h
f.y = i
g.s = f
g.w = k
g.t = k
g.z = m
h.t = f
h.y = i
assert i.q.t.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: D = None
        self.y: E = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

m.u = f
m.w = h
m.y = g
m.z = g
k.w = m
k.x = m
i.q = h
f.t = h
f.y = i
g.s = f
g.w = k
g.t = k
g.z = m
h.t = f
h.y = i
assert i.q.t.y.q.txt == "h"