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

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

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

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

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

k = A("k")
i = B("i")
f = C("f")
b = D("b")
h = E("h")
c = A("c")
g = D("g")
a = C("a")
n = E("n")

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

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

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

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

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

k = A("k")
i = B("i")
f = C("f")
b = D("b")
h = E("h")
c = A("c")
g = D("g")
a = C("a")
n = E("n")

k.r = g
k.q = n
k.v = n
i.p = h
i.t = n
i.u = f
f.o = b
f.t = a
b.p = f
b.o = c
h.w = a
h.z = c
h.q = f
c.r = g
c.q = h
c.v = n
g.p = f
g.o = c
a.o = g
a.t = f
n.w = a
n.q = a
n.z = k
assert a.o.p.o.o.txt == "c"