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

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

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

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

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

n = A("n")
h = B("h")
l = C("l")
f = D("f")
g = E("g")

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

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

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

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

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

n = A("n")
h = B("h")
l = C("l")
f = D("f")
g = E("g")

n.r = g
n.w = g
n.p = g
n.s = l
n.o = f
h.o = g
h.z = f
h.y = l
l.o = f
l.w = g
f.r = l
f.z = n
g.v = n
g.o = n
g.w = l
g.q = l
assert l.o.r.o.r.o.txt == "f"