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

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

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

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

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

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

l.w = e
e.s = j
e.w = l
e.x = b
b.s = e
j.v = b
j.q = e
a.s = e
a.u = l
assert j.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

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

l.w = e
e.s = j
e.w = l
e.x = b
b.s = e
j.v = b
j.q = e
a.s = e
a.u = l
assert j.v.s.s.txt == "j"