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

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

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

h = A("h")
j = B("j")
g = C("g")

h.t = g
h.v = g
h.s = j
j.z = g
j.u = h
g.x = h
assert j.z.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
g = C("g")

h.t = g
h.v = g
h.s = j
j.z = g
j.u = h
g.x = h
assert j.z.x.s.txt == "j"