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

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

i = A("i")
f = B("f")
k = B("k")
e = A("e")
j = B("j")
h = B("h")
c = B("c")
g = B("g")
a = B("a")
b = B("b")

i.z = e
f.o = j
f.w = i
k.o = b
k.w = e
e.z = i
j.o = f
j.w = e
h.o = a
h.w = e
c.o = k
c.w = i
g.o = h
g.w = e
a.o = h
a.w = e
b.o = k
b.w = i
assert f.w.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
k = B("k")
e = A("e")
j = B("j")
h = B("h")
c = B("c")
g = B("g")
a = B("a")
b = B("b")

i.z = e
f.o = j
f.w = i
k.o = b
k.w = e
e.z = i
j.o = f
j.w = e
h.o = a
h.w = e
c.o = k
c.w = i
g.o = h
g.w = e
a.o = h
a.w = e
b.o = k
b.w = i
assert f.w.z.z.z.z.z.z.z.txt == "e"