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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: D = None
        self.t: C = None
        self.z: D = None
        self.y: C = None
        self.txt = txt

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

n.o = h
g.v = n
g.q = n
g.r = n
e.w = g
e.y = h
h.v = j
h.q = e
h.s = e
j.w = n
j.v = h
j.z = h
j.t = e
j.y = e
assert h.s.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: D = None
        self.t: C = None
        self.z: D = None
        self.y: C = None
        self.txt = txt

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

n.o = h
g.v = n
g.q = n
g.r = n
e.w = g
e.y = h
h.v = j
h.q = e
h.s = e
j.w = n
j.v = h
j.z = h
j.t = e
j.y = e
assert h.s.w.q.txt == "n"