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

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

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

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

j.o = n
j.t = n
j.z = m
n.w = g
h.o = l
h.w = n
h.p = n
g.o = n
g.w = n
g.p = l
d.o = n
d.z = m
d.t = l
l.w = g
k.o = l
k.t = l
k.z = m
m.o = n
m.w = n
m.p = n
i.o = l
i.w = l
i.p = l
assert i.p.w.o.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: C = None
        self.t: B = None
        self.txt = txt

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

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

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

j.o = n
j.t = n
j.z = m
n.w = g
h.o = l
h.w = n
h.p = n
g.o = n
g.w = n
g.p = l
d.o = n
d.z = m
d.t = l
l.w = g
k.o = l
k.t = l
k.z = m
m.o = n
m.w = n
m.p = n
i.o = l
i.w = l
i.p = l
assert i.p.w.o.w.p.txt == "l"