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

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

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

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

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

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

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

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

b.r = g
b.v = g
b.o = e
g.v = b
e.y = g
assert b.o.y.v.txt == "b"