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

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

l = A("l")
b = B("b")
n = B("n")
i = A("i")
d = A("d")
e = B("e")
j = B("j")
f = A("f")
h = A("h")
g = A("g")

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

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

l = A("l")
b = B("b")
n = B("n")
i = A("i")
d = A("d")
e = B("e")
j = B("j")
f = A("f")
h = A("h")
g = A("g")

l.s = h
l.x = j
b.w = e
b.v = j
n.w = e
n.v = j
i.s = d
i.x = n
d.s = h
d.x = b
e.w = b
e.v = n
j.w = e
j.v = b
f.s = g
f.x = n
h.s = g
h.x = b
g.s = d
g.x = n
assert d.x.w.w.w.w.w.txt == "e"