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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
i = C("i")
g = D("g")
h = E("h")
d = B("d")

l.t = m
l.o = d
m.z = d
m.w = d
m.s = i
m.y = i
m.t = h
i.s = h
i.w = l
i.o = g
i.r = g
g.s = m
g.w = i
h.w = i
d.z = m
d.w = m
d.s = i
d.y = i
d.t = h
assert g.w.o.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
i = C("i")
g = D("g")
h = E("h")
d = B("d")

l.t = m
l.o = d
m.z = d
m.w = d
m.s = i
m.y = i
m.t = h
i.s = h
i.w = l
i.o = g
i.r = g
g.s = m
g.w = i
h.w = i
d.z = m
d.w = m
d.s = i
d.y = i
d.t = h
assert g.w.o.w.s.w.txt == "i"