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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: B = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: E = None
        self.y: D = None
        self.v: E = None
        self.t: C = None
        self.txt = txt

b = A("b")
a = B("a")
m = C("m")
k = D("k")
e = E("e")
d = C("d")
n = A("n")
c = C("c")
f = B("f")
g = E("g")

b.q = n
a.u = e
a.r = f
a.x = n
m.y = f
m.x = f
m.r = e
m.p = c
k.u = g
k.t = g
k.x = e
k.o = b
k.r = f
e.o = n
e.u = g
e.v = g
e.y = k
e.t = m
d.y = a
d.x = a
d.r = e
d.p = m
n.q = b
c.y = f
c.x = a
c.r = e
c.p = m
f.u = e
f.r = a
f.x = n
g.o = n
g.u = e
g.v = e
g.y = k
g.t = m
assert b.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: B = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: E = None
        self.y: D = None
        self.v: E = None
        self.t: C = None
        self.txt = txt

b = A("b")
a = B("a")
m = C("m")
k = D("k")
e = E("e")
d = C("d")
n = A("n")
c = C("c")
f = B("f")
g = E("g")

b.q = n
a.u = e
a.r = f
a.x = n
m.y = f
m.x = f
m.r = e
m.p = c
k.u = g
k.t = g
k.x = e
k.o = b
k.r = f
e.o = n
e.u = g
e.v = g
e.y = k
e.t = m
d.y = a
d.x = a
d.r = e
d.p = m
n.q = b
c.y = f
c.x = a
c.r = e
c.p = m
f.u = e
f.r = a
f.x = n
g.o = n
g.u = e
g.v = e
g.y = k
g.t = m
assert b.q.q.q.q.q.txt == "n"