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

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

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

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

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

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

d.q = f
d.z = h
n.q = l
n.r = b
h.u = d
h.y = d
h.o = f
h.r = n
b.r = d
b.u = f
b.t = f
b.y = g
f.z = n
f.q = h
i.u = d
i.y = d
i.o = f
i.r = g
g.q = l
g.r = b
l.q = n
l.r = b
assert i.u.z.u.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

d.q = f
d.z = h
n.q = l
n.r = b
h.u = d
h.y = d
h.o = f
h.r = n
b.r = d
b.u = f
b.t = f
b.y = g
f.z = n
f.q = h
i.u = d
i.y = d
i.o = f
i.r = g
g.q = l
g.r = b
l.q = n
l.r = b
assert i.u.z.u.q.z.q.txt == "l"