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

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

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

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

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

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

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