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

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

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

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

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

n = A("n")
m = B("m")
h = C("h")
l = D("l")
b = E("b")
c = C("c")

n.s = b
n.y = m
m.r = b
m.o = l
m.p = n
h.v = n
l.z = n
l.o = n
l.s = h
b.s = l
b.o = l
b.p = c
b.w = n
c.v = n
assert h.v.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: B = None
        self.txt = txt

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

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

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

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

n = A("n")
m = B("m")
h = C("h")
l = D("l")
b = E("b")
c = C("c")

n.s = b
n.y = m
m.r = b
m.o = l
m.p = n
h.v = n
l.z = n
l.o = n
l.s = h
b.s = l
b.o = l
b.p = c
b.w = n
c.v = n
assert h.v.y.r.txt == "b"