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

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

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

i = A("i")
h = B("h")
d = C("d")
b = B("b")
m = C("m")
c = B("c")
l = A("l")
a = B("a")
e = C("e")
n = B("n")

i.z = h
i.x = b
h.o = e
h.w = e
h.t = d
d.q = l
b.o = d
b.w = e
b.t = e
m.q = i
c.o = d
c.w = m
c.t = m
l.z = n
l.x = c
a.o = e
a.w = m
a.t = m
e.q = i
n.o = d
n.w = e
n.t = m
assert m.q.x.o.q.x.w.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
d = C("d")
b = B("b")
m = C("m")
c = B("c")
l = A("l")
a = B("a")
e = C("e")
n = B("n")

i.z = h
i.x = b
h.o = e
h.w = e
h.t = d
d.q = l
b.o = d
b.w = e
b.t = e
m.q = i
c.o = d
c.w = m
c.t = m
l.z = n
l.x = c
a.o = e
a.w = m
a.t = m
e.q = i
n.o = d
n.w = e
n.t = m
assert m.q.x.o.q.x.w.q.x.txt == "b"