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

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

n = A("n")
a = B("a")
l = B("l")
h = A("h")
c = A("c")
k = A("k")

n.y = c
a.v = l
l.v = a
h.y = k
c.y = n
k.y = n
assert h.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

n = A("n")
a = B("a")
l = B("l")
h = A("h")
c = A("c")
k = A("k")

n.y = c
a.v = l
l.v = a
h.y = k
c.y = n
k.y = n
assert h.y.y.y.y.y.y.txt == "n"