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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: A = None
        self.o: E = None
        self.z: A = None
        self.p: E = None
        self.txt = txt

g = A("g")
k = B("k")
h = C("h")
b = D("b")
d = E("d")
i = C("i")
a = E("a")
c = C("c")

g.y = k
g.z = k
g.r = k
g.u = b
g.p = b
k.w = i
k.s = g
k.r = g
h.y = b
h.r = a
h.s = k
h.q = g
b.q = a
d.u = k
d.t = g
d.z = g
d.o = a
d.p = a
i.y = b
i.r = d
i.s = k
i.q = g
a.u = k
a.t = g
a.z = g
a.o = d
a.p = d
c.y = b
c.r = d
c.s = k
c.q = g
assert c.s.w.s.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.u: D = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: A = None
        self.o: E = None
        self.z: A = None
        self.p: E = None
        self.txt = txt

g = A("g")
k = B("k")
h = C("h")
b = D("b")
d = E("d")
i = C("i")
a = E("a")
c = C("c")

g.y = k
g.z = k
g.r = k
g.u = b
g.p = b
k.w = i
k.s = g
k.r = g
h.y = b
h.r = a
h.s = k
h.q = g
b.q = a
d.u = k
d.t = g
d.z = g
d.o = a
d.p = a
i.y = b
i.r = d
i.s = k
i.q = g
a.u = k
a.t = g
a.z = g
a.o = d
a.p = d
c.y = b
c.r = d
c.s = k
c.q = g
assert c.s.w.s.r.p.txt == "b"