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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
c = C("c")
f = D("f")
m = E("m")
e = E("e")
h = A("h")
j = C("j")

n.o = h
n.q = c
n.u = m
n.v = j
l.s = c
l.y = h
l.p = f
l.o = f
l.w = j
c.v = l
f.u = m
f.r = e
f.z = l
m.o = h
m.v = j
e.o = h
e.v = c
h.o = n
h.q = c
h.u = e
h.v = j
j.v = l
assert n.q.v.w.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: C = None
        self.u: E = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
c = C("c")
f = D("f")
m = E("m")
e = E("e")
h = A("h")
j = C("j")

n.o = h
n.q = c
n.u = m
n.v = j
l.s = c
l.y = h
l.p = f
l.o = f
l.w = j
c.v = l
f.u = m
f.r = e
f.z = l
m.o = h
m.v = j
e.o = h
e.v = c
h.o = n
h.q = c
h.u = e
h.v = j
j.v = l
assert n.q.v.w.v.o.txt == "f"