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

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

d = A("d")
l = B("l")
j = A("j")
m = A("m")
k = B("k")
b = A("b")
e = B("e")
g = B("g")
i = A("i")

d.v = k
d.s = m
l.w = k
j.v = l
j.s = i
m.v = k
m.s = d
k.w = g
b.v = e
b.s = i
e.w = l
g.w = k
i.v = k
i.s = b
assert e.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: A = None
        self.txt = txt

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

d = A("d")
l = B("l")
j = A("j")
m = A("m")
k = B("k")
b = A("b")
e = B("e")
g = B("g")
i = A("i")

d.v = k
d.s = m
l.w = k
j.v = l
j.s = i
m.v = k
m.s = d
k.w = g
b.v = e
b.s = i
e.w = l
g.w = k
i.v = k
i.s = b
assert e.w.w.w.w.w.w.txt == "k"