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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

i = A("i")
h = B("h")
l = C("l")
d = D("d")
f = E("f")
e = E("e")
c = C("c")
k = A("k")
j = A("j")
n = C("n")

i.t = d
i.u = h
i.r = h
i.q = l
h.q = l
h.o = n
h.r = f
l.w = e
l.q = h
l.s = j
l.x = c
d.q = e
f.t = h
f.p = e
f.s = e
f.x = d
e.t = h
e.p = f
e.s = f
e.x = d
c.w = f
c.q = h
c.s = j
c.x = n
k.t = d
k.u = h
k.r = h
k.q = c
j.t = d
j.u = h
j.r = h
j.q = c
n.w = f
n.q = h
n.s = k
n.x = l
assert f.x.q.t.q.x.q.r.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: B = None
        self.r: B = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

i = A("i")
h = B("h")
l = C("l")
d = D("d")
f = E("f")
e = E("e")
c = C("c")
k = A("k")
j = A("j")
n = C("n")

i.t = d
i.u = h
i.r = h
i.q = l
h.q = l
h.o = n
h.r = f
l.w = e
l.q = h
l.s = j
l.x = c
d.q = e
f.t = h
f.p = e
f.s = e
f.x = d
e.t = h
e.p = f
e.s = f
e.x = d
c.w = f
c.q = h
c.s = j
c.x = n
k.t = d
k.u = h
k.r = h
k.q = c
j.t = d
j.u = h
j.r = h
j.q = c
n.w = f
n.q = h
n.s = k
n.x = l
assert f.x.q.t.q.x.q.r.x.q.x.txt == "d"