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

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

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

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

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

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

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

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

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

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

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

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

j.r = g
j.z = m
j.w = i
j.v = k
i.y = k
i.x = h
g.w = j
g.u = k
g.q = i
k.o = j
m.o = k
m.q = k
m.t = k
m.z = j
h.w = j
h.u = k
h.q = i
assert m.q.o.r.txt == "g"