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

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

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

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

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

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

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

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

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

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

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

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

h.u = i
h.y = c
h.x = j
c.u = k
c.r = h
c.y = h
e.r = i
e.s = i
e.u = i
e.t = h
j.t = e
i.p = j
i.s = j
i.r = e
i.z = c
i.u = h
k.u = c
k.r = h
k.y = h
assert j.t.r.p.t.txt == "e"