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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.o: C = None
        self.txt = txt

j = A("j")
a = B("a")
f = C("f")
l = B("l")
m = A("m")
e = A("e")
i = C("i")
h = A("h")

j.q = h
j.r = l
j.z = a
a.s = f
f.v = i
f.w = i
f.o = i
l.s = f
m.q = h
m.r = a
m.z = l
e.q = j
e.r = a
e.z = l
i.v = f
i.w = f
i.o = f
h.q = e
h.r = l
h.z = l
assert i.v.o.o.v.w.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.o: C = None
        self.txt = txt

j = A("j")
a = B("a")
f = C("f")
l = B("l")
m = A("m")
e = A("e")
i = C("i")
h = A("h")

j.q = h
j.r = l
j.z = a
a.s = f
f.v = i
f.w = i
f.o = i
l.s = f
m.q = h
m.r = a
m.z = l
e.q = j
e.r = a
e.z = l
i.v = f
i.w = f
i.o = f
h.q = e
h.r = l
h.z = l
assert i.v.o.o.v.w.w.v.txt == "f"