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

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

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

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

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

n = A("n")
h = B("h")
b = C("b")
i = D("i")
e = E("e")
c = C("c")
j = E("j")

n.p = c
n.s = h
n.u = h
n.q = i
h.q = e
h.u = c
b.o = n
b.p = j
b.z = j
b.v = c
b.u = e
i.z = n
i.p = j
i.w = b
e.z = b
c.o = n
c.p = j
c.v = b
c.z = e
c.u = e
j.z = c
assert c.v.u.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.q: D = None
        self.u: B = None
        self.txt = txt

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

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

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

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

n = A("n")
h = B("h")
b = C("b")
i = D("i")
e = E("e")
c = C("c")
j = E("j")

n.p = c
n.s = h
n.u = h
n.q = i
h.q = e
h.u = c
b.o = n
b.p = j
b.z = j
b.v = c
b.u = e
i.z = n
i.p = j
i.w = b
e.z = b
c.o = n
c.p = j
c.v = b
c.z = e
c.u = e
j.z = c
assert c.v.u.z.o.txt == "n"