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

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

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

j = A("j")
i = B("i")
m = C("m")
k = B("k")
f = C("f")
h = B("h")
d = C("d")
a = C("a")
n = B("n")

j.w = f
j.y = m
j.o = n
i.o = d
i.s = n
m.q = i
k.o = f
k.s = h
f.q = i
h.o = f
h.s = n
d.q = n
a.q = n
n.o = d
n.s = h
assert n.s.o.q.s.s.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: C = None
        self.o: B = None
        self.txt = txt

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

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

j = A("j")
i = B("i")
m = C("m")
k = B("k")
f = C("f")
h = B("h")
d = C("d")
a = C("a")
n = B("n")

j.w = f
j.y = m
j.o = n
i.o = d
i.s = n
m.q = i
k.o = f
k.s = h
f.q = i
h.o = f
h.s = n
d.q = n
a.q = n
n.o = d
n.s = h
assert n.s.o.q.s.s.s.o.txt == "d"