class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.txt = txt

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

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

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

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

m = A("m")
l = B("l")
d = C("d")
n = D("n")
j = E("j")
a = C("a")
e = E("e")
b = E("b")
f = C("f")
h = A("h")

m.r = n
m.x = b
l.u = a
l.t = a
l.o = d
d.v = n
d.p = a
d.z = b
d.w = m
d.q = l
n.y = f
n.x = h
j.o = h
a.v = n
a.p = d
a.z = e
a.w = h
a.q = l
e.o = m
b.o = h
f.v = n
f.p = d
f.z = j
f.w = m
f.q = l
h.r = n
h.x = j
assert h.r.x.x.o.r.y.z.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: E = None
        self.txt = txt

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

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

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

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

m = A("m")
l = B("l")
d = C("d")
n = D("n")
j = E("j")
a = C("a")
e = E("e")
b = E("b")
f = C("f")
h = A("h")

m.r = n
m.x = b
l.u = a
l.t = a
l.o = d
d.v = n
d.p = a
d.z = b
d.w = m
d.q = l
n.y = f
n.x = h
j.o = h
a.v = n
a.p = d
a.z = e
a.w = h
a.q = l
e.o = m
b.o = h
f.v = n
f.p = d
f.z = j
f.w = m
f.q = l
h.r = n
h.x = j
assert h.r.x.x.o.r.y.z.o.r.txt == "n"