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

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

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

c = A("c")
b = B("b")
i = C("i")
n = C("n")

c.o = i
c.q = i
b.w = i
b.u = c
i.y = c
n.y = c
assert c.o.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
i = C("i")
n = C("n")

c.o = i
c.q = i
b.w = i
b.u = c
i.y = c
n.y = c
assert c.o.y.o.y.txt == "c"