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

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

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

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

c.y = g
g.t = b
b.v = c
b.x = g
assert c.y.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

c.y = g
g.t = b
b.v = c
b.x = g
assert c.y.t.x.txt == "g"