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

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

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

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

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

c = A("c")
h = B("h")
g = C("g")
i = D("i")
n = E("n")
e = A("e")
d = B("d")

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

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

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

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

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

c = A("c")
h = B("h")
g = C("g")
i = D("i")
n = E("n")
e = A("e")
d = B("d")

c.p = e
c.s = d
h.q = g
h.v = g
h.t = i
h.o = i
g.w = n
g.u = c
g.x = h
g.y = h
g.v = i
i.z = h
n.w = g
n.y = g
e.p = c
e.s = d
d.q = g
d.v = g
d.t = i
d.o = i
assert c.s.q.v.z.q.v.txt == "i"