class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: A = None
        self.q: E = None
        self.s: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: D = None
        self.w: C = None
        self.t: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

i.y = g
i.r = b
i.q = e
i.z = e
i.s = a
d.x = g
d.z = a
d.w = l
d.t = k
d.q = e
l.p = d
l.q = g
a.q = l
e.o = i
j.q = n
b.y = d
b.r = i
b.q = e
b.z = e
b.s = j
k.p = g
k.q = g
n.p = d
n.q = d
g.x = d
g.z = a
g.w = k
g.t = n
g.q = e
assert k.p.z.q.p.t.p.x.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: A = None
        self.q: E = None
        self.s: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: D = None
        self.w: C = None
        self.t: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

i.y = g
i.r = b
i.q = e
i.z = e
i.s = a
d.x = g
d.z = a
d.w = l
d.t = k
d.q = e
l.p = d
l.q = g
a.q = l
e.o = i
j.q = n
b.y = d
b.r = i
b.q = e
b.z = e
b.s = j
k.p = g
k.q = g
n.p = d
n.q = d
g.x = d
g.z = a
g.w = k
g.t = n
g.q = e
assert k.p.z.q.p.t.p.x.x.t.txt == "n"