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

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

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

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

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

d = A("d")
g = B("g")
l = C("l")
n = D("n")
e = E("e")
h = D("h")
i = C("i")
j = B("j")

d.w = g
d.s = h
g.r = e
g.s = e
g.v = e
g.p = d
l.z = d
l.u = n
l.r = h
n.o = i
e.w = d
e.y = d
e.u = l
h.o = i
i.z = d
i.u = h
i.r = h
j.r = e
j.s = e
j.v = e
j.p = d
assert e.y.w.r.u.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: D = None
        self.txt = txt

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

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

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

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

d = A("d")
g = B("g")
l = C("l")
n = D("n")
e = E("e")
h = D("h")
i = C("i")
j = B("j")

d.w = g
d.s = h
g.r = e
g.s = e
g.v = e
g.p = d
l.z = d
l.u = n
l.r = h
n.o = i
e.w = d
e.y = d
e.u = l
h.o = i
i.z = d
i.u = h
i.r = h
j.r = e
j.s = e
j.v = e
j.p = d
assert e.y.w.r.u.z.w.txt == "g"