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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: A = None
        self.q: C = None
        self.txt = txt

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

e = A("e")
m = B("m")
b = C("b")
a = D("a")
i = A("i")
k = D("k")
g = B("g")
j = C("j")
h = D("h")

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: A = None
        self.q: C = None
        self.txt = txt

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

e = A("e")
m = B("m")
b = C("b")
a = D("a")
i = A("i")
k = D("k")
g = B("g")
j = C("j")
h = D("h")

e.w = h
e.x = b
e.z = m
e.u = a
m.r = i
b.r = e
b.o = e
b.q = j
a.s = m
a.r = m
a.w = h
a.v = i
i.w = h
i.u = h
i.x = j
i.z = m
k.s = g
k.r = m
k.w = a
k.v = e
g.r = i
j.r = e
j.o = e
j.q = b
h.s = m
h.r = m
h.w = k
h.v = i
assert a.w.r.r.u.txt == "h"