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

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

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

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

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

f.x = m
f.z = a
a.q = d
a.o = c
a.s = b
c.q = m
c.v = a
m.v = a
m.z = c
m.t = d
e.q = m
e.v = a
d.v = a
d.z = b
d.t = m
b.q = d
b.v = a
assert f.z.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: B = None
        self.txt = txt

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

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

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

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

f.x = m
f.z = a
a.q = d
a.o = c
a.s = b
c.q = m
c.v = a
m.v = a
m.z = c
m.t = d
e.q = m
e.v = a
d.v = a
d.z = b
d.t = m
b.q = d
b.v = a
assert f.z.o.v.o.txt == "c"