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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: C = None
        self.z: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: C = None
        self.z: C = None
        self.p: D = None
        self.txt = txt

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

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

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