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

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

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

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

j.p = n
j.s = n
j.x = a
i.p = a
e.t = m
e.y = h
e.s = d
k.p = a
a.t = i
a.y = d
a.s = h
m.p = a
h.p = a
n.p = c
n.s = c
n.x = a
c.p = j
c.s = n
c.x = e
d.p = e
assert n.s.s.x.y.p.y.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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

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

j.p = n
j.s = n
j.x = a
i.p = a
e.t = m
e.y = h
e.s = d
k.p = a
a.t = i
a.y = d
a.s = h
m.p = a
h.p = a
n.p = c
n.s = c
n.x = a
c.p = j
c.s = n
c.x = e
d.p = e
assert n.s.s.x.y.p.y.p.t.txt == "i"