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

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

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

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

a.o = e
a.x = g
a.z = g
g.y = a
g.z = a
g.v = a
e.r = g
assert e.r.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: B = None
        self.z: B = None
        self.txt = txt

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

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

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

a.o = e
a.x = g
a.z = g
g.y = a
g.z = a
g.v = a
e.r = g
assert e.r.y.o.txt == "e"