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

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

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

c.x = i
c.u = n
i.r = l
i.v = l
j.x = i
j.u = l
l.x = i
l.u = n
n.x = i
n.u = j
assert i.v.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: A = None
        self.txt = txt

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

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

c.x = i
c.u = n
i.r = l
i.v = l
j.x = i
j.u = l
l.x = i
l.u = n
n.x = i
n.u = j
assert i.v.x.r.txt == "l"