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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

g.w = n
m.q = n
m.z = n
m.x = g
n.p = g
i.o = g
i.u = n
e.v = m
e.o = m
e.s = n
e.y = n
e.p = h
c.o = g
c.u = n
h.w = n
assert h.w.p.w.p.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

g.w = n
m.q = n
m.z = n
m.x = g
n.p = g
i.o = g
i.u = n
e.v = m
e.o = m
e.s = n
e.y = n
e.p = h
c.o = g
c.u = n
h.w = n
assert h.w.p.w.p.w.p.w.txt == "n"