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

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

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

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

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

j = A("j")
l = B("l")
a = C("a")
e = D("e")
h = E("h")

j.r = a
j.v = l
l.s = h
l.u = h
l.r = j
a.y = h
e.t = j
e.q = h
h.q = e
h.z = l
h.r = j
assert j.v.s.q.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: B = None
        self.txt = txt

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

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

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

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

j = A("j")
l = B("l")
a = C("a")
e = D("e")
h = E("h")

j.r = a
j.v = l
l.s = h
l.u = h
l.r = j
a.y = h
e.t = j
e.q = h
h.q = e
h.z = l
h.r = j
assert j.v.s.q.t.v.txt == "l"