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

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

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

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

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

d = A("d")
n = B("n")
l = C("l")
a = D("a")
m = E("m")
h = D("h")
e = B("e")
f = D("f")

d.p = m
d.x = m
d.y = n
n.w = d
l.t = d
a.y = n
a.u = n
a.z = n
a.o = l
a.w = d
m.s = d
m.x = d
m.y = d
m.r = e
h.y = n
h.o = l
h.u = e
h.z = e
h.w = d
e.w = d
f.y = e
f.z = e
f.o = l
f.u = n
f.w = d
assert n.w.p.x.x.r.w.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.y: B = None
        self.txt = txt

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

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

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

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

d = A("d")
n = B("n")
l = C("l")
a = D("a")
m = E("m")
h = D("h")
e = B("e")
f = D("f")

d.p = m
d.x = m
d.y = n
n.w = d
l.t = d
a.y = n
a.u = n
a.z = n
a.o = l
a.w = d
m.s = d
m.x = d
m.y = d
m.r = e
h.y = n
h.o = l
h.u = e
h.z = e
h.w = d
e.w = d
f.y = e
f.z = e
f.o = l
f.u = n
f.w = d
assert n.w.p.x.x.r.w.p.y.txt == "d"