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

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

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

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

n.w = f
n.p = d
e.o = i
e.p = n
e.t = b
i.y = d
j.y = l
k.w = f
k.p = d
f.o = i
f.p = k
f.t = b
l.o = i
l.p = k
l.t = n
d.o = j
d.p = k
d.t = n
b.w = f
b.p = f
assert d.o.y.o.y.o.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: B = None
        self.txt = txt

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

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

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

n.w = f
n.p = d
e.o = i
e.p = n
e.t = b
i.y = d
j.y = l
k.w = f
k.p = d
f.o = i
f.p = k
f.t = b
l.o = i
l.p = k
l.t = n
d.o = j
d.p = k
d.t = n
b.w = f
b.p = f
assert d.o.y.o.y.o.y.o.y.txt == "d"