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

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

c = A("c")
l = B("l")
i = B("i")
n = A("n")
k = A("k")

c.u = k
c.x = n
l.z = k
i.z = c
n.u = c
n.x = k
k.u = n
k.x = n
assert l.z.u.u.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: A = None
        self.txt = txt

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

c = A("c")
l = B("l")
i = B("i")
n = A("n")
k = A("k")

c.u = k
c.x = n
l.z = k
i.z = c
n.u = c
n.x = k
k.u = n
k.x = n
assert l.z.u.u.u.x.txt == "n"