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

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

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

a = A("a")
n = B("n")
i = C("i")
h = A("h")

a.s = n
a.t = n
n.u = a
n.x = h
i.v = n
h.s = n
h.t = n
assert n.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
i = C("i")
h = A("h")

a.s = n
a.t = n
n.u = a
n.x = h
i.v = n
h.s = n
h.t = n
assert n.u.t.u.t.txt == "n"