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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: B = None
        self.s: C = None
        self.w: B = None
        self.r: C = None
        self.txt = txt

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

k = A("k")
j = B("j")
i = C("i")
m = D("m")
f = E("f")
d = E("d")
g = A("g")
c = B("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: B = None
        self.s: C = None
        self.w: B = None
        self.r: C = None
        self.txt = txt

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

k = A("k")
j = B("j")
i = C("i")
m = D("m")
f = E("f")
d = E("d")
g = A("g")
c = B("c")

k.u = j
k.p = j
j.p = f
j.q = i
i.u = k
i.z = k
i.o = m
i.w = m
i.y = f
m.z = k
m.t = c
m.w = c
m.s = i
m.r = i
f.q = g
f.w = c
f.p = i
d.q = g
d.w = j
d.p = i
g.u = c
g.p = c
c.p = f
c.q = i
assert f.q.u.p.p.z.u.q.txt == "i"