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

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

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

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

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

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

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

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

h.x = g
h.t = j
g.z = h
j.z = g
assert g.z.x.z.txt == "h"