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

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

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

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

e.x = g
e.p = g
e.s = j
c.q = g
c.t = e
c.u = k
i.w = n
i.r = m
n.w = i
n.r = k
a.q = j
a.t = e
a.u = m
j.x = e
j.s = e
j.p = g
g.x = j
g.s = j
g.p = e
m.q = e
m.t = e
m.u = c
k.q = g
k.t = j
k.u = m
assert m.t.s.p.x.s.x.s.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: A = None
        self.s: A = None
        self.txt = txt

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

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

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

e.x = g
e.p = g
e.s = j
c.q = g
c.t = e
c.u = k
i.w = n
i.r = m
n.w = i
n.r = k
a.q = j
a.t = e
a.u = m
j.x = e
j.s = e
j.p = g
g.x = j
g.s = j
g.p = e
m.q = e
m.t = e
m.u = c
k.q = g
k.t = j
k.u = m
assert m.t.s.p.x.s.x.s.p.x.txt == "j"