class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: D = None
        self.u: E = None
        self.w: C = None
        self.q: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.o: B = None
        self.txt = txt

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

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

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