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

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

b = A("b")
i = B("i")
a = B("a")
j = B("j")
k = B("k")
m = A("m")
n = A("n")
g = A("g")
f = B("f")
h = B("h")

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

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

b = A("b")
i = B("i")
a = B("a")
j = B("j")
k = B("k")
m = A("m")
n = A("n")
g = A("g")
f = B("f")
h = B("h")

b.v = g
b.y = h
i.z = j
i.v = h
a.z = i
a.v = k
j.z = a
j.v = h
k.z = a
k.v = h
m.v = b
m.y = f
n.v = g
n.y = j
g.v = b
g.y = f
f.z = i
f.v = j
h.z = f
h.v = i
assert i.v.z.z.txt == "i"