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

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

j = A("j")
i = B("i")
m = A("m")
g = B("g")
l = B("l")
k = A("k")
n = B("n")
h = A("h")
e = A("e")
c = A("c")

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

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

j = A("j")
i = B("i")
m = A("m")
g = B("g")
l = B("l")
k = A("k")
n = B("n")
h = A("h")
e = A("e")
c = A("c")

j.v = e
j.x = g
i.w = l
i.s = h
m.v = h
m.x = n
g.w = l
g.s = j
l.w = n
l.s = e
k.v = h
k.x = i
n.w = i
n.s = m
h.v = j
h.x = g
e.v = k
e.x = n
c.v = e
c.x = l
assert g.w.w.s.x.w.s.txt == "h"