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

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

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

j.y = i
j.w = b
e.v = f
e.z = h
i.y = l
i.w = e
n.y = i
n.w = f
f.v = b
f.z = j
h.y = l
h.w = f
k.y = j
k.w = f
b.v = e
b.z = l
l.y = h
l.w = b
assert f.z.w.v.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: B = None
        self.txt = txt

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

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

j.y = i
j.w = b
e.v = f
e.z = h
i.y = l
i.w = e
n.y = i
n.w = f
f.v = b
f.z = j
h.y = l
h.w = f
k.y = j
k.w = f
b.v = e
b.z = l
l.y = h
l.w = b
assert f.z.w.v.z.y.txt == "l"