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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
g = C("g")
e = D("e")
c = E("c")
h = A("h")
f = C("f")
i = E("i")

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
g = C("g")
e = D("e")
c = E("c")
h = A("h")
f = C("f")
i = E("i")

k.p = j
k.o = h
k.r = i
j.y = f
j.q = k
j.u = k
j.v = i
g.r = h
g.u = e
g.z = e
e.s = h
e.w = f
e.q = c
e.t = i
c.x = j
c.t = f
h.p = j
h.o = k
h.r = c
f.r = k
f.u = e
f.z = e
i.x = j
i.t = f
assert g.z.w.r.txt == "k"