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

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

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

l = A("l")
m = B("m")
j = C("j")
h = A("h")
e = C("e")
k = B("k")
g = B("g")
b = B("b")
f = A("f")

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

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

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

l = A("l")
m = B("m")
j = C("j")
h = A("h")
e = C("e")
k = B("k")
g = B("g")
b = B("b")
f = A("f")

l.z = k
l.v = h
l.w = h
m.s = f
m.q = e
j.s = h
h.z = b
h.v = l
h.w = l
e.s = l
k.s = h
k.q = e
g.s = h
g.q = e
b.s = l
b.q = e
f.z = k
f.v = l
f.w = h
assert m.s.w.v.z.s.txt == "h"