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

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

n = A("n")
h = B("h")
c = B("c")
e = B("e")
a = A("a")

n.v = c
n.z = a
h.z = a
h.t = c
c.z = n
c.t = e
e.z = n
e.t = c
a.v = e
a.z = n
assert c.t.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.txt = txt

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

n = A("n")
h = B("h")
c = B("c")
e = B("e")
a = A("a")

n.v = c
n.z = a
h.z = a
h.t = c
c.z = n
c.t = e
e.z = n
e.t = c
a.v = e
a.z = n
assert c.t.z.z.z.z.txt == "a"