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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: A = None
        self.txt = txt

g = A("g")
n = B("n")
b = C("b")
m = D("m")
i = E("i")
k = A("k")
a = C("a")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: A = None
        self.txt = txt

g = A("g")
n = B("n")
b = C("b")
m = D("m")
i = E("i")
k = A("k")
a = C("a")

g.x = m
g.y = a
g.o = n
g.z = n
n.q = m
n.z = m
n.s = a
n.v = a
b.y = i
b.x = i
b.u = m
b.s = n
b.t = a
m.r = k
m.o = b
m.q = g
i.z = b
i.s = g
k.x = m
k.y = a
k.o = n
k.z = n
a.y = i
a.x = i
a.u = m
a.s = n
a.t = b
assert m.o.t.u.r.o.txt == "n"