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

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

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

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

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

n = A("n")
d = B("d")
g = C("g")
k = D("k")
h = E("h")
b = B("b")
f = D("f")

n.p = g
n.w = g
n.y = g
d.w = g
d.s = g
d.u = b
g.p = d
g.w = b
g.z = n
g.v = n
g.s = k
k.w = n
k.y = n
k.r = n
h.o = g
b.w = g
b.s = g
b.u = d
f.w = n
f.y = n
f.r = n
assert g.p.u.u.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

n = A("n")
d = B("d")
g = C("g")
k = D("k")
h = E("h")
b = B("b")
f = D("f")

n.p = g
n.w = g
n.y = g
d.w = g
d.s = g
d.u = b
g.p = d
g.w = b
g.z = n
g.v = n
g.s = k
k.w = n
k.y = n
k.r = n
h.o = g
b.w = g
b.s = g
b.u = d
f.w = n
f.y = n
f.r = n
assert g.p.u.u.s.w.txt == "b"