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

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

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

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

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

l = A("l")
k = B("k")
h = C("h")
f = D("f")
a = E("a")
n = A("n")
b = D("b")

l.w = f
k.x = h
k.y = h
k.p = n
h.u = k
h.s = b
f.o = h
f.q = h
f.w = n
f.z = b
f.u = k
a.p = h
n.w = f
b.o = h
b.q = h
b.w = n
b.z = f
b.u = k
assert k.p.w.w.w.w.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
h = C("h")
f = D("f")
a = E("a")
n = A("n")
b = D("b")

l.w = f
k.x = h
k.y = h
k.p = n
h.u = k
h.s = b
f.o = h
f.q = h
f.w = n
f.z = b
f.u = k
a.p = h
n.w = f
b.o = h
b.q = h
b.w = n
b.z = f
b.u = k
assert k.p.w.w.w.w.w.q.txt == "h"