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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.u: B = None
        self.p: B = None
        self.o: D = None
        self.txt = txt

l = A("l")
n = B("n")
m = C("m")
c = D("c")
f = E("f")
e = D("e")
d = A("d")

l.o = m
n.o = m
n.z = m
n.u = c
m.x = f
m.z = f
m.q = c
m.v = n
c.r = d
f.z = e
f.s = n
f.u = n
f.p = n
f.o = c
e.r = d
d.o = m
assert m.q.r.o.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.u: B = None
        self.p: B = None
        self.o: D = None
        self.txt = txt

l = A("l")
n = B("n")
m = C("m")
c = D("c")
f = E("f")
e = D("e")
d = A("d")

l.o = m
n.o = m
n.z = m
n.u = c
m.x = f
m.z = f
m.q = c
m.v = n
c.r = d
f.z = e
f.s = n
f.u = n
f.p = n
f.o = c
e.r = d
d.o = m
assert m.q.r.o.v.u.txt == "c"