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

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

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

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

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

n = A("n")
j = B("j")
h = C("h")
i = D("i")
c = E("c")
f = C("f")
a = D("a")

n.o = c
n.y = c
n.r = c
n.p = a
n.v = f
j.w = f
j.t = f
j.q = c
j.z = n
j.v = n
h.y = c
i.v = a
i.x = h
c.z = j
c.p = j
c.q = n
c.v = a
f.y = c
a.v = i
a.x = h
assert a.v.x.y.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: D = None
        self.v: C = None
        self.y: E = None
        self.r: E = None
        self.txt = txt

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

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

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

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

n = A("n")
j = B("j")
h = C("h")
i = D("i")
c = E("c")
f = C("f")
a = D("a")

n.o = c
n.y = c
n.r = c
n.p = a
n.v = f
j.w = f
j.t = f
j.q = c
j.z = n
j.v = n
h.y = c
i.v = a
i.x = h
c.z = j
c.p = j
c.q = n
c.v = a
f.y = c
a.v = i
a.x = h
assert a.v.x.y.q.v.txt == "f"