class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = 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: A = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

b = A("b")
h = B("h")
k = C("k")
g = C("g")
n = A("n")

b.u = h
b.t = h
h.z = n
k.z = b
k.x = b
k.v = n
g.z = b
g.x = b
g.v = b
n.u = h
n.t = h
assert g.x.t.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = 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: A = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

b = A("b")
h = B("h")
k = C("k")
g = C("g")
n = A("n")

b.u = h
b.t = h
h.z = n
k.z = b
k.x = b
k.v = n
g.z = b
g.x = b
g.v = b
n.u = h
n.t = h
assert g.x.t.z.t.z.txt == "n"