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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.s: A = None
        self.w: A = None
        self.q: A = None
        self.txt = txt

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

e = A("e")
b = B("b")
i = C("i")
g = D("g")
d = E("d")
j = A("j")
f = B("f")
m = C("m")

e.w = j
b.t = d
b.u = m
i.y = d
i.x = d
i.w = j
g.x = j
g.w = j
g.u = f
g.s = e
g.q = e
d.t = g
d.x = g
j.w = e
f.t = d
f.u = m
m.y = d
m.x = d
m.w = j
assert d.x.q.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.s: A = None
        self.w: A = None
        self.q: A = None
        self.txt = txt

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

e = A("e")
b = B("b")
i = C("i")
g = D("g")
d = E("d")
j = A("j")
f = B("f")
m = C("m")

e.w = j
b.t = d
b.u = m
i.y = d
i.x = d
i.w = j
g.x = j
g.w = j
g.u = f
g.s = e
g.q = e
d.t = g
d.x = g
j.w = e
f.t = d
f.u = m
m.y = d
m.x = d
m.w = j
assert d.x.q.w.w.w.w.w.txt == "j"