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

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

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

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

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

c = A("c")
n = B("n")
f = C("f")
b = D("b")
k = E("k")
d = D("d")
g = A("g")
h = A("h")
e = A("e")

c.u = n
c.q = f
c.p = h
c.w = k
c.y = e
n.q = k
n.y = f
f.z = d
f.y = e
f.x = h
f.t = n
b.s = f
b.r = f
b.p = n
b.v = k
k.x = n
d.s = f
d.r = f
d.p = n
d.v = k
g.u = n
g.q = f
g.p = c
g.w = k
g.y = h
h.u = n
h.q = f
h.p = g
h.w = k
h.y = e
e.u = n
e.q = f
e.p = h
e.w = k
e.y = c
assert d.s.z.s.t.y.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: C = None
        self.p: A = None
        self.w: E = None
        self.y: A = None
        self.txt = txt

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

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

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

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

c = A("c")
n = B("n")
f = C("f")
b = D("b")
k = E("k")
d = D("d")
g = A("g")
h = A("h")
e = A("e")

c.u = n
c.q = f
c.p = h
c.w = k
c.y = e
n.q = k
n.y = f
f.z = d
f.y = e
f.x = h
f.t = n
b.s = f
b.r = f
b.p = n
b.v = k
k.x = n
d.s = f
d.r = f
d.p = n
d.v = k
g.u = n
g.q = f
g.p = c
g.w = k
g.y = h
h.u = n
h.q = f
h.p = g
h.w = k
h.y = e
e.u = n
e.q = f
e.p = h
e.w = k
e.y = c
assert d.s.z.s.t.y.z.r.z.txt == "d"