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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.s: B = None
        self.txt = txt

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

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

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

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