class A:
    def __init__(self, txt: str):
        self.o: 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.w: B = None
        self.txt = txt

i = A("i")
m = B("m")
j = C("j")
n = B("n")

i.o = j
m.q = j
j.w = n
n.q = j
assert j.w.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: 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.w: B = None
        self.txt = txt

i = A("i")
m = B("m")
j = C("j")
n = B("n")

i.o = j
m.q = j
j.w = n
n.q = j
assert j.w.q.w.txt == "n"