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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.txt = txt

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

l = A("l")
m = B("m")
h = C("h")
c = D("c")
k = E("k")
d = A("d")
f = C("f")
a = B("a")

l.r = d
l.u = h
l.w = k
l.t = m
l.s = m
m.x = k
m.s = d
m.z = a
h.q = f
h.p = f
h.s = c
h.x = l
h.w = d
c.w = l
c.r = d
k.p = c
k.x = f
k.w = m
k.o = m
d.r = l
d.u = h
d.w = k
d.t = m
d.s = a
f.q = h
f.p = h
f.s = c
f.x = d
f.w = d
a.x = k
a.s = d
a.z = m
assert m.z.s.t.s.w.x.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: C = None
        self.w: E = None
        self.t: B = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.txt = txt

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

l = A("l")
m = B("m")
h = C("h")
c = D("c")
k = E("k")
d = A("d")
f = C("f")
a = B("a")

l.r = d
l.u = h
l.w = k
l.t = m
l.s = m
m.x = k
m.s = d
m.z = a
h.q = f
h.p = f
h.s = c
h.x = l
h.w = d
c.w = l
c.r = d
k.p = c
k.x = f
k.w = m
k.o = m
d.r = l
d.u = h
d.w = k
d.t = m
d.s = a
f.q = h
f.p = h
f.s = c
f.x = d
f.w = d
a.x = k
a.s = d
a.z = m
assert m.z.s.t.s.w.x.s.r.txt == "d"