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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: A = None
        self.x: B = None
        self.o: E = None
        self.txt = txt

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

a.q = d
a.v = d
a.w = f
a.z = b
b.r = a
f.u = a
k.p = m
k.x = n
k.t = f
m.w = h
m.z = a
m.x = b
m.o = i
d.q = a
d.v = a
d.w = f
d.z = b
i.w = n
i.z = d
i.x = b
i.o = m
h.p = m
h.x = n
h.t = f
n.p = m
n.x = k
n.t = f
assert k.t.u.z.r.w.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.z: B = None
        self.v: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: A = None
        self.x: B = None
        self.o: E = None
        self.txt = txt

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

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