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

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

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

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

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

m = A("m")
h = B("h")
g = C("g")
n = D("n")
l = E("l")
j = C("j")
k = B("k")

m.r = h
m.q = g
m.u = n
h.x = n
h.p = j
h.u = j
h.y = k
h.z = l
g.o = j
g.s = l
g.z = m
n.x = m
n.s = l
l.r = n
l.x = n
l.o = m
l.q = m
j.o = g
j.s = l
j.z = m
k.x = n
k.p = j
k.u = j
k.y = h
k.z = l
assert j.s.q.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: C = None
        self.u: D = None
        self.txt = txt

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

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

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

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

m = A("m")
h = B("h")
g = C("g")
n = D("n")
l = E("l")
j = C("j")
k = B("k")

m.r = h
m.q = g
m.u = n
h.x = n
h.p = j
h.u = j
h.y = k
h.z = l
g.o = j
g.s = l
g.z = m
n.x = m
n.s = l
l.r = n
l.x = n
l.o = m
l.q = m
j.o = g
j.s = l
j.z = m
k.x = n
k.p = j
k.u = j
k.y = h
k.z = l
assert j.s.q.r.u.txt == "j"