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

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

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

g = A("g")
e = B("e")
n = C("n")

g.x = e
g.o = n
e.w = g
n.t = g
n.o = e
assert e.w.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
n = C("n")

g.x = e
g.o = n
e.w = g
n.t = g
n.o = e
assert e.w.o.t.txt == "g"