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

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

k = A("k")
i = B("i")
c = A("c")
j = B("j")
a = A("a")
b = B("b")
n = B("n")
l = A("l")

k.s = a
k.y = a
i.x = c
i.v = n
c.s = l
c.y = l
j.x = c
j.v = b
a.s = l
a.y = l
b.x = k
b.v = j
n.x = l
n.v = j
l.s = a
l.y = c
assert l.y.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: A = None
        self.txt = txt

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

k = A("k")
i = B("i")
c = A("c")
j = B("j")
a = A("a")
b = B("b")
n = B("n")
l = A("l")

k.s = a
k.y = a
i.x = c
i.v = n
c.s = l
c.y = l
j.x = c
j.v = b
a.s = l
a.y = l
b.x = k
b.v = j
n.x = l
n.v = j
l.s = a
l.y = c
assert l.y.y.s.y.txt == "l"