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

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

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

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

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

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

l.q = n
l.v = n
l.r = h
h.r = g
h.u = m
h.o = a
a.s = h
a.w = c
a.o = k
m.o = c
m.r = g
b.w = l
c.q = m
c.v = m
c.r = h
n.o = c
n.r = h
k.o = e
k.r = g
g.r = h
g.u = n
g.o = a
e.q = n
e.v = n
e.r = g
assert a.o.r.r.r.u.o.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: B = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

l.q = n
l.v = n
l.r = h
h.r = g
h.u = m
h.o = a
a.s = h
a.w = c
a.o = k
m.o = c
m.r = g
b.w = l
c.q = m
c.v = m
c.r = h
n.o = c
n.r = h
k.o = e
k.r = g
g.r = h
g.u = n
g.o = a
e.q = n
e.v = n
e.r = g
assert a.o.r.r.r.u.o.r.u.r.txt == "g"