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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.txt = txt

a = A("a")
b = B("b")
e = C("e")
i = A("i")
f = B("f")
m = A("m")
g = C("g")
j = A("j")

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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.txt = txt

a = A("a")
b = B("b")
e = C("e")
i = A("i")
f = B("f")
m = A("m")
g = C("g")
j = A("j")

a.w = m
a.z = i
a.o = j
b.z = i
e.p = g
e.r = b
i.w = m
i.z = m
i.o = m
f.z = i
m.w = i
m.z = a
m.o = j
g.p = e
g.r = b
j.w = i
j.z = i
j.o = a
assert j.o.w.w.w.z.w.o.txt == "j"