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

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

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

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

l.q = e
i.q = f
e.o = i
f.o = i
assert e.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

l.q = e
i.q = f
e.o = i
f.o = i
assert e.o.q.o.txt == "i"