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

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

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

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

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

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

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

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

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

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

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

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

n.r = h
n.x = m
n.w = g
n.v = a
a.v = g
a.z = g
a.q = n
m.r = h
g.u = n
g.x = l
g.y = l
g.z = h
g.o = h
h.z = m
h.s = m
l.v = g
l.z = g
l.q = n
assert g.o.s.r.s.r.z.txt == "m"