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

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

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

i = A("i")
l = B("l")
f = C("f")
g = A("g")

i.w = l
l.t = i
l.u = f
f.o = l
g.w = l
assert i.w.u.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

i = A("i")
l = B("l")
f = C("f")
g = A("g")

i.w = l
l.t = i
l.u = f
f.o = l
g.w = l
assert i.w.u.o.t.txt == "i"