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

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

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

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

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

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

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

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

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

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

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

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

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