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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
b = C("b")
c = D("c")
f = E("f")
l = B("l")
a = D("a")
n = E("n")
k = D("k")

h.r = l
h.w = l
h.t = f
h.p = f
g.p = b
b.s = g
b.w = a
b.u = f
b.z = h
c.v = n
c.s = l
c.w = a
c.p = f
f.w = b
f.x = n
f.y = g
f.r = h
l.p = b
a.v = f
a.p = f
a.s = l
a.w = c
n.w = b
n.x = f
n.y = g
n.r = h
k.v = f
k.p = f
k.s = l
k.w = c
assert h.r.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: E = None
        self.p: E = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
b = C("b")
c = D("c")
f = E("f")
l = B("l")
a = D("a")
n = E("n")
k = D("k")

h.r = l
h.w = l
h.t = f
h.p = f
g.p = b
b.s = g
b.w = a
b.u = f
b.z = h
c.v = n
c.s = l
c.w = a
c.p = f
f.w = b
f.x = n
f.y = g
f.r = h
l.p = b
a.v = f
a.p = f
a.s = l
a.w = c
n.w = b
n.x = f
n.y = g
n.r = h
k.v = f
k.p = f
k.s = l
k.w = c
assert h.r.p.s.txt == "g"