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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: E = None
        self.txt = txt

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

k = A("k")
f = B("f")
n = C("n")
b = D("b")
m = E("m")
j = A("j")

k.q = j
k.w = m
k.p = b
k.o = b
f.x = b
f.r = m
f.v = n
f.q = n
n.t = f
n.v = f
n.u = m
n.z = m
b.w = f
b.u = m
m.r = n
m.y = n
m.v = b
j.q = k
j.w = m
j.p = b
j.o = b
assert f.x.w.x.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: E = None
        self.p: D = None
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: E = None
        self.txt = txt

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

k = A("k")
f = B("f")
n = C("n")
b = D("b")
m = E("m")
j = A("j")

k.q = j
k.w = m
k.p = b
k.o = b
f.x = b
f.r = m
f.v = n
f.q = n
n.t = f
n.v = f
n.u = m
n.z = m
b.w = f
b.u = m
m.r = n
m.y = n
m.v = b
j.q = k
j.w = m
j.p = b
j.o = b
assert f.x.w.x.w.r.txt == "m"