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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
i = C("i")
l = D("l")
e = E("e")

f.v = l
b.r = e
b.y = e
b.u = f
i.w = f
l.p = b
l.q = f
l.w = f
e.v = b
e.r = b
e.o = l
assert f.v.q.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
i = C("i")
l = D("l")
e = E("e")

f.v = l
b.r = e
b.y = e
b.u = f
i.w = f
l.p = b
l.q = f
l.w = f
e.v = b
e.r = b
e.o = l
assert f.v.q.v.w.txt == "f"