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

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

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

a = A("a")
e = B("e")
f = C("f")
l = C("l")
h = A("h")

a.q = e
a.v = e
a.s = f
e.r = l
e.y = l
f.s = l
f.z = e
l.s = f
l.z = e
h.q = e
h.v = e
h.s = f
assert f.z.r.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.s: C = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
f = C("f")
l = C("l")
h = A("h")

a.q = e
a.v = e
a.s = f
e.r = l
e.y = l
f.s = l
f.z = e
l.s = f
l.z = e
h.q = e
h.v = e
h.s = f
assert f.z.r.z.y.txt == "l"