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

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

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

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

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

g = A("g")
k = B("k")
i = C("i")
h = D("h")
m = E("m")
f = C("f")
l = A("l")

g.y = h
g.p = l
g.s = l
g.r = k
k.o = h
k.t = f
k.q = m
i.p = m
i.y = m
i.r = m
i.u = f
i.v = f
h.o = f
h.s = l
h.p = l
h.r = k
m.t = g
m.v = i
f.p = m
f.y = m
f.r = m
f.u = i
f.v = i
l.y = h
l.p = g
l.s = g
l.r = k
assert m.t.y.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: A = None
        self.s: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

g = A("g")
k = B("k")
i = C("i")
h = D("h")
m = E("m")
f = C("f")
l = A("l")

g.y = h
g.p = l
g.s = l
g.r = k
k.o = h
k.t = f
k.q = m
i.p = m
i.y = m
i.r = m
i.u = f
i.v = f
h.o = f
h.s = l
h.p = l
h.r = k
m.t = g
m.v = i
f.p = m
f.y = m
f.r = m
f.u = i
f.v = i
l.y = h
l.p = g
l.s = g
l.r = k
assert m.t.y.r.q.txt == "m"