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

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

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

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

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

h = A("h")
f = B("f")
d = C("d")
g = D("g")
j = E("j")
m = B("m")
b = E("b")
i = A("i")

h.q = m
h.s = g
h.o = j
h.z = d
h.y = d
f.v = g
d.o = j
g.o = i
j.u = g
j.s = g
j.o = g
j.r = h
m.v = g
b.u = g
b.s = g
b.o = g
b.r = h
i.q = m
i.s = g
i.o = b
i.z = d
i.y = d
assert g.o.s.o.s.o.o.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: D = None
        self.o: E = None
        self.z: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

h = A("h")
f = B("f")
d = C("d")
g = D("g")
j = E("j")
m = B("m")
b = E("b")
i = A("i")

h.q = m
h.s = g
h.o = j
h.z = d
h.y = d
f.v = g
d.o = j
g.o = i
j.u = g
j.s = g
j.o = g
j.r = h
m.v = g
b.u = g
b.s = g
b.o = g
b.r = h
i.q = m
i.s = g
i.o = b
i.z = d
i.y = d
assert g.o.s.o.s.o.o.r.s.txt == "g"