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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.p: E = 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.w: C = None
        self.q: C = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: E = None
        self.x: D = None
        self.z: E = None
        self.q: D = None
        self.txt = txt

c = A("c")
b = B("b")
n = C("n")
e = D("e")
h = E("h")
f = A("f")
d = A("d")
g = E("g")

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.p: E = 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.w: C = None
        self.q: C = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: E = None
        self.x: D = None
        self.z: E = None
        self.q: D = None
        self.txt = txt

c = A("c")
b = B("b")
n = C("n")
e = D("e")
h = E("h")
f = A("f")
d = A("d")
g = E("g")

c.o = d
c.s = g
c.q = g
c.z = n
c.y = e
b.y = e
b.z = h
b.p = g
n.r = g
e.w = n
e.q = n
e.u = n
e.p = g
h.r = f
h.v = g
h.z = g
h.x = e
h.q = e
f.o = c
f.s = g
f.q = g
f.z = n
f.y = e
d.o = f
d.s = h
d.q = h
d.z = n
d.y = e
g.r = f
g.v = h
g.z = h
g.x = e
g.q = e
assert n.r.z.q.p.r.z.r.txt == "g"