class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
n = C("n")
f = D("f")
a = E("a")
c = E("c")
l = A("l")
g = A("g")
j = B("j")

d.p = g
d.s = f
d.t = c
k.s = j
k.y = j
n.s = f
n.o = d
n.r = d
n.p = j
n.t = k
f.p = k
f.w = n
a.w = n
c.w = n
l.p = g
l.s = f
l.t = c
g.p = l
g.s = f
g.t = c
j.s = k
j.y = k
assert n.t.y.s.s.y.s.y.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
n = C("n")
f = D("f")
a = E("a")
c = E("c")
l = A("l")
g = A("g")
j = B("j")

d.p = g
d.s = f
d.t = c
k.s = j
k.y = j
n.s = f
n.o = d
n.r = d
n.p = j
n.t = k
f.p = k
f.w = n
a.w = n
c.w = n
l.p = g
l.s = f
l.t = c
g.p = l
g.s = f
g.t = c
j.s = k
j.y = k
assert n.t.y.s.s.y.s.y.s.s.txt == "k"