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

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

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

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

g = A("g")
h = B("h")
i = C("i")
m = D("m")
a = A("a")
e = B("e")
l = C("l")
n = B("n")
c = C("c")

g.w = a
g.o = m
h.z = m
h.q = m
h.w = l
h.x = n
i.x = e
i.t = m
i.w = g
i.q = h
m.p = c
m.w = e
a.w = g
a.o = m
e.z = m
e.q = m
e.w = l
e.x = n
l.x = h
l.q = h
l.t = m
l.w = g
n.z = m
n.q = m
n.w = c
n.x = h
c.x = e
c.t = m
c.w = a
c.q = h
assert c.t.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: D = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
i = C("i")
m = D("m")
a = A("a")
e = B("e")
l = C("l")
n = B("n")
c = C("c")

g.w = a
g.o = m
h.z = m
h.q = m
h.w = l
h.x = n
i.x = e
i.t = m
i.w = g
i.q = h
m.p = c
m.w = e
a.w = g
a.o = m
e.z = m
e.q = m
e.w = l
e.x = n
l.x = h
l.q = h
l.t = m
l.w = g
n.z = m
n.q = m
n.w = c
n.x = h
c.x = e
c.t = m
c.w = a
c.q = h
assert c.t.w.w.w.w.w.txt == "g"