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

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

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

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

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

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

f.q = c
f.s = d
f.z = k
k.o = f
k.r = f
k.v = m
m.y = f
m.z = b
m.x = a
c.x = b
c.q = i
c.p = a
c.t = k
j.q = f
j.x = b
d.y = f
d.z = j
d.x = c
i.o = f
i.r = f
i.v = d
b.q = f
b.x = j
a.x = j
a.q = i
a.p = c
a.t = k
assert a.t.r.z.r.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

f.q = c
f.s = d
f.z = k
k.o = f
k.r = f
k.v = m
m.y = f
m.z = b
m.x = a
c.x = b
c.q = i
c.p = a
c.t = k
j.q = f
j.x = b
d.y = f
d.z = j
d.x = c
i.o = f
i.r = f
i.v = d
b.q = f
b.x = j
a.x = j
a.q = i
a.p = c
a.t = k
assert a.t.r.z.r.q.t.txt == "k"