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

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

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

l = A("l")
a = B("a")
e = C("e")
g = B("g")

l.o = e
a.x = l
a.w = l
a.t = l
e.s = a
g.x = l
g.w = l
g.t = l
assert a.w.o.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

l = A("l")
a = B("a")
e = C("e")
g = B("g")

l.o = e
a.x = l
a.w = l
a.t = l
e.s = a
g.x = l
g.w = l
g.t = l
assert a.w.o.s.x.txt == "l"