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

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

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

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

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

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

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

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

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

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

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

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

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