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

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

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

h = A("h")
i = B("i")
a = C("a")
g = A("g")
l = C("l")

h.y = i
i.w = a
a.w = i
a.y = i
a.t = i
g.y = i
l.w = i
l.y = i
l.t = i
assert i.w.y.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
a = C("a")
g = A("g")
l = C("l")

h.y = i
i.w = a
a.w = i
a.y = i
a.t = i
g.y = i
l.w = i
l.y = i
l.t = i
assert i.w.y.w.w.txt == "i"