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

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

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

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

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

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

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

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

e.u = m
e.x = j
e.p = j
c.t = j
c.z = e
c.w = h
i.p = h
i.w = c
m.u = j
m.p = j
m.x = e
j.u = m
j.x = m
j.p = e
h.p = n
h.w = c
g.t = k
g.z = e
g.w = n
k.u = j
k.x = j
k.p = j
n.p = i
n.w = g
assert m.x.p.x.p.x.p.x.txt == "m"