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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.u: D = None
        self.txt = txt

n = A("n")
c = B("c")
i = C("i")
k = D("k")
h = E("h")

n.u = c
n.s = k
n.r = i
c.p = k
c.v = n
i.q = h
i.t = n
i.z = c
i.x = k
i.v = k
k.p = c
k.y = n
k.s = n
h.r = c
h.q = c
h.u = k
assert h.r.p.y.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.u: D = None
        self.txt = txt

n = A("n")
c = B("c")
i = C("i")
k = D("k")
h = E("h")

n.u = c
n.s = k
n.r = i
c.p = k
c.v = n
i.q = h
i.t = n
i.z = c
i.x = k
i.v = k
k.p = c
k.y = n
k.s = n
h.r = c
h.q = c
h.u = k
assert h.r.p.y.s.p.txt == "c"