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

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

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

c = A("c")
j = B("j")
e = C("e")
i = C("i")

c.o = i
c.w = j
c.u = e
j.y = c
e.s = j
e.u = c
e.o = i
i.s = j
i.u = c
i.o = e
assert i.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
e = C("e")
i = C("i")

c.o = i
c.w = j
c.u = e
j.y = c
e.s = j
e.u = c
e.o = i
i.s = j
i.u = c
i.o = e
assert i.o.u.o.txt == "i"