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

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

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

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

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

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

m.w = n
m.t = b
m.y = l
g.o = l
i.x = n
i.z = n
i.w = b
d.y = b
e.z = b
e.o = d
n.o = i
b.w = n
b.t = m
b.y = l
l.x = n
l.z = n
l.w = b
assert l.w.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: A = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

m.w = n
m.t = b
m.y = l
g.o = l
i.x = n
i.z = n
i.w = b
d.y = b
e.z = b
e.o = d
n.o = i
b.w = n
b.t = m
b.y = l
l.x = n
l.z = n
l.w = b
assert l.w.w.o.w.txt == "b"