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

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

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

f = A("f")
l = B("l")
d = C("d")
b = C("b")
g = B("g")

f.s = d
f.x = l
f.y = b
l.y = g
d.w = l
d.v = l
d.q = l
b.w = l
b.v = l
b.q = g
g.y = l
assert b.q.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
d = C("d")
b = C("b")
g = B("g")

f.s = d
f.x = l
f.y = b
l.y = g
d.w = l
d.v = l
d.q = l
b.w = l
b.v = l
b.q = g
g.y = l
assert b.q.y.y.txt == "g"