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

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

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

l = A("l")
b = B("b")
m = C("m")
d = C("d")
f = A("f")
n = A("n")
i = B("i")
h = A("h")
k = A("k")
e = A("e")

l.y = e
l.s = d
b.w = i
b.z = d
b.x = d
m.o = i
m.u = d
d.o = b
d.u = m
f.y = n
f.s = d
n.y = f
n.s = m
i.w = b
i.z = m
i.x = d
h.y = l
h.s = m
k.y = h
k.s = m
e.y = n
e.s = d
assert i.z.o.x.o.z.o.z.o.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
m = C("m")
d = C("d")
f = A("f")
n = A("n")
i = B("i")
h = A("h")
k = A("k")
e = A("e")

l.y = e
l.s = d
b.w = i
b.z = d
b.x = d
m.o = i
m.u = d
d.o = b
d.u = m
f.y = n
f.s = d
n.y = f
n.s = m
i.w = b
i.z = m
i.x = d
h.y = l
h.s = m
k.y = h
k.s = m
e.y = n
e.s = d
assert i.z.o.x.o.z.o.z.o.w.z.txt == "m"