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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.y: A = None
        self.u: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.y: A = None
        self.u: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

l.r = a
a.o = l
a.y = l
a.w = c
a.u = h
a.q = b
h.z = b
h.o = a
h.w = a
h.p = l
b.z = c
b.r = a
b.v = a
c.o = l
assert b.v.q.v.w.o.txt == "l"