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

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

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

j = A("j")
h = B("h")
e = C("e")
n = B("n")
m = B("m")
l = B("l")
d = A("d")
i = C("i")
g = C("g")
f = B("f")

j.o = l
h.s = l
h.w = l
h.p = m
e.q = f
e.u = n
n.s = m
n.w = m
n.p = l
m.s = f
m.w = f
m.p = l
l.s = m
l.w = m
l.p = n
d.o = l
i.q = h
i.u = m
g.q = m
g.u = l
f.s = n
f.w = h
f.p = l
assert f.w.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

j = A("j")
h = B("h")
e = C("e")
n = B("n")
m = B("m")
l = B("l")
d = A("d")
i = C("i")
g = C("g")
f = B("f")

j.o = l
h.s = l
h.w = l
h.p = m
e.q = f
e.u = n
n.s = m
n.w = m
n.p = l
m.s = f
m.w = f
m.p = l
l.s = m
l.w = m
l.p = n
d.o = l
i.q = h
i.u = m
g.q = m
g.u = l
f.s = n
f.w = h
f.p = l
assert f.w.w.w.s.txt == "f"