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

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

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

n = A("n")
h = B("h")
b = C("b")
e = B("e")

n.x = b
n.u = e
h.z = n
h.y = b
b.v = n
b.t = n
b.y = n
e.z = n
e.y = b
assert h.y.t.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: B = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
b = C("b")
e = B("e")

n.x = b
n.u = e
h.z = n
h.y = b
b.v = n
b.t = n
b.y = n
e.z = n
e.y = b
assert h.y.t.x.v.txt == "n"