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

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

m = A("m")
n = B("n")
b = A("b")
k = A("k")
e = A("e")
h = A("h")
i = A("i")
a = A("a")
l = B("l")
c = B("c")

m.u = h
n.v = h
b.u = a
k.u = e
e.u = k
h.u = b
i.u = h
a.u = b
l.v = b
c.v = k
assert c.v.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

m = A("m")
n = B("n")
b = A("b")
k = A("k")
e = A("e")
h = A("h")
i = A("i")
a = A("a")
l = B("l")
c = B("c")

m.u = h
n.v = h
b.u = a
k.u = e
e.u = k
h.u = b
i.u = h
a.u = b
l.v = b
c.v = k
assert c.v.u.u.u.u.u.u.txt == "k"