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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.s: B = None
        self.o: B = None
        self.y: C = None
        self.txt = txt

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

m = A("m")
l = B("l")
e = C("e")
n = D("n")
d = E("d")
a = D("a")
b = D("b")
k = C("k")
g = D("g")
i = A("i")

m.p = i
l.r = d
l.z = d
l.x = m
l.w = k
e.p = d
e.z = l
e.r = n
e.w = i
n.v = d
n.r = d
n.s = l
n.o = l
n.y = k
d.u = i
d.r = l
d.p = k
a.v = d
a.r = d
a.s = l
a.o = l
a.y = k
b.v = d
b.r = d
b.s = l
b.o = l
b.y = e
k.p = d
k.z = l
k.r = a
k.w = m
g.v = d
g.r = d
g.s = l
g.o = l
g.y = k
i.p = m
assert e.w.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.s: B = None
        self.o: B = None
        self.y: C = None
        self.txt = txt

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

m = A("m")
l = B("l")
e = C("e")
n = D("n")
d = E("d")
a = D("a")
b = D("b")
k = C("k")
g = D("g")
i = A("i")

m.p = i
l.r = d
l.z = d
l.x = m
l.w = k
e.p = d
e.z = l
e.r = n
e.w = i
n.v = d
n.r = d
n.s = l
n.o = l
n.y = k
d.u = i
d.r = l
d.p = k
a.v = d
a.r = d
a.s = l
a.o = l
a.y = k
b.v = d
b.r = d
b.s = l
b.o = l
b.y = e
k.p = d
k.z = l
k.r = a
k.w = m
g.v = d
g.r = d
g.s = l
g.o = l
g.y = k
i.p = m
assert e.w.p.p.p.p.p.p.txt == "i"