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

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

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

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

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

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

e.r = c
a.r = h
a.o = h
a.u = n
a.w = j
a.x = j
h.r = j
h.y = n
g.u = j
g.t = e
g.s = a
c.r = e
c.o = e
c.w = g
n.u = j
n.t = e
n.s = a
l.u = c
l.t = e
l.s = a
j.r = e
j.o = e
j.w = g
assert n.s.u.s.u.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

e.r = c
a.r = h
a.o = h
a.u = n
a.w = j
a.x = j
h.r = j
h.y = n
g.u = j
g.t = e
g.s = a
c.r = e
c.o = e
c.w = g
n.u = j
n.t = e
n.s = a
l.u = c
l.t = e
l.s = a
j.r = e
j.o = e
j.w = g
assert n.s.u.s.u.s.r.txt == "h"