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

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

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

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

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

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

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

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

g.w = c
g.u = d
g.t = j
d.o = k
n.p = g
l.o = h
j.p = g
c.w = g
c.u = h
c.t = j
a.o = h
h.o = a
i.w = g
i.u = k
i.t = n
k.o = d
assert n.p.t.p.u.o.o.o.o.o.txt == "k"