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

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

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

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

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

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

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

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

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

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

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

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

f.r = m
f.w = e
i.q = g
i.p = f
i.u = j
g.x = m
g.o = i
g.z = b
g.q = b
d.r = l
d.y = l
d.q = f
b.p = i
b.r = f
b.q = e
b.z = g
b.y = d
m.p = j
m.r = f
m.q = e
m.y = e
m.z = g
n.p = i
n.r = f
n.q = e
n.z = g
n.y = l
l.r = d
l.y = d
l.q = f
e.r = l
e.y = l
e.q = f
j.q = g
j.p = f
j.u = i
assert b.z.x.z.z.q.q.w.txt == "e"