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

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

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

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

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

g = A("g")
j = B("j")
n = C("n")
c = D("c")
m = E("m")
d = A("d")

g.u = d
g.y = m
g.t = n
g.q = n
g.w = j
j.o = g
j.q = m
j.x = n
n.x = j
n.w = j
n.y = j
n.p = c
c.x = m
c.w = m
c.t = n
c.y = n
m.s = g
d.u = g
d.y = m
d.t = n
d.q = n
d.w = j
assert d.w.x.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: E = None
        self.t: C = None
        self.q: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

g = A("g")
j = B("j")
n = C("n")
c = D("c")
m = E("m")
d = A("d")

g.u = d
g.y = m
g.t = n
g.q = n
g.w = j
j.o = g
j.q = m
j.x = n
n.x = j
n.w = j
n.y = j
n.p = c
c.x = m
c.w = m
c.t = n
c.y = n
m.s = g
d.u = g
d.y = m
d.t = n
d.q = n
d.w = j
assert d.w.x.w.q.txt == "m"