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

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

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

m = A("m")
e = B("e")
f = C("f")
d = A("d")
l = B("l")
a = B("a")

m.q = f
m.o = f
e.t = f
e.y = f
e.z = l
f.v = e
d.q = f
d.o = f
l.t = f
l.y = f
l.z = a
a.t = f
a.y = f
a.z = e
assert e.z.t.v.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: C = None
        self.txt = txt

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

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

m = A("m")
e = B("e")
f = C("f")
d = A("d")
l = B("l")
a = B("a")

m.q = f
m.o = f
e.t = f
e.y = f
e.z = l
f.v = e
d.q = f
d.o = f
l.t = f
l.y = f
l.z = a
a.t = f
a.y = f
a.z = e
assert e.z.t.v.z.z.txt == "a"