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

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

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

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

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

d = A("d")
c = B("c")
l = C("l")
b = D("b")
m = E("m")
a = B("a")
f = E("f")

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

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

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

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

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

d = A("d")
c = B("c")
l = C("l")
b = D("b")
m = E("m")
a = B("a")
f = E("f")

d.q = l
c.o = d
c.v = b
c.z = f
c.s = a
l.r = c
l.x = b
b.z = f
m.s = l
m.y = f
a.o = d
a.v = b
a.z = f
a.s = c
f.s = l
f.y = m
assert c.v.z.s.r.o.txt == "d"