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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.o: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: A = None
        self.txt = txt

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

m = A("m")
g = B("g")
k = C("k")
l = D("l")
d = E("d")
b = E("b")
e = A("e")

m.w = e
m.v = l
m.x = l
m.u = k
g.t = m
k.y = g
k.q = g
k.o = d
l.v = b
l.s = e
d.x = l
d.q = e
b.x = l
b.q = m
e.w = m
e.v = l
e.x = l
e.u = k
assert g.t.w.w.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: D = None
        self.x: D = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.o: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: A = None
        self.txt = txt

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

m = A("m")
g = B("g")
k = C("k")
l = D("l")
d = E("d")
b = E("b")
e = A("e")

m.w = e
m.v = l
m.x = l
m.u = k
g.t = m
k.y = g
k.q = g
k.o = d
l.v = b
l.s = e
d.x = l
d.q = e
b.x = l
b.q = m
e.w = m
e.v = l
e.x = l
e.u = k
assert g.t.w.w.w.u.txt == "k"