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

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

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

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

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

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

c.z = a
n.z = a
n.s = a
g.s = j
g.p = c
g.q = c
g.u = h
g.x = n
h.o = c
h.r = n
h.v = a
h.z = j
h.y = j
j.s = h
j.w = c
j.q = c
a.z = n
a.s = n
assert j.q.z.s.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

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

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

c.z = a
n.z = a
n.s = a
g.s = j
g.p = c
g.q = c
g.u = h
g.x = n
h.o = c
h.r = n
h.v = a
h.z = j
h.y = j
j.s = h
j.w = c
j.q = c
a.z = n
a.s = n
assert j.q.z.s.s.z.s.txt == "a"