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

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

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

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

l.q = i
f.x = m
f.z = l
f.y = e
i.w = h
i.t = l
i.z = l
e.x = m
e.z = l
e.y = f
a.w = h
a.t = l
a.z = l
n.x = e
n.z = l
n.y = m
h.w = i
h.t = l
h.z = l
m.x = e
m.z = l
m.y = n
assert n.z.q.w.w.w.t.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

l.q = i
f.x = m
f.z = l
f.y = e
i.w = h
i.t = l
i.z = l
e.x = m
e.z = l
e.y = f
a.w = h
a.t = l
a.z = l
n.x = e
n.z = l
n.y = m
h.w = i
h.t = l
h.z = l
m.x = e
m.z = l
m.y = n
assert n.z.q.w.w.w.t.q.w.txt == "h"