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

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

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

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

f = A("f")
j = B("j")
k = C("k")
e = D("e")
i = B("i")
m = A("m")
a = D("a")
n = B("n")
b = A("b")

f.x = k
f.u = n
j.u = e
j.v = e
j.s = k
j.q = k
k.w = j
e.w = j
i.u = e
i.s = k
i.q = k
i.v = a
m.x = k
m.u = j
a.w = i
n.u = e
n.v = e
n.s = k
n.q = k
b.x = k
b.u = n
assert m.x.w.q.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: B = None
        self.txt = txt

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

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

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

f = A("f")
j = B("j")
k = C("k")
e = D("e")
i = B("i")
m = A("m")
a = D("a")
n = B("n")
b = A("b")

f.x = k
f.u = n
j.u = e
j.v = e
j.s = k
j.q = k
k.w = j
e.w = j
i.u = e
i.s = k
i.q = k
i.v = a
m.x = k
m.u = j
a.w = i
n.u = e
n.v = e
n.s = k
n.q = k
b.x = k
b.u = n
assert m.x.w.q.w.u.txt == "e"