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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

l = A("l")
k = B("k")
m = C("m")
n = D("n")
b = E("b")

l.x = k
k.s = m
k.o = b
m.v = b
m.p = l
m.s = k
n.p = b
b.v = k
b.w = k
b.q = l
b.z = l
b.p = n
assert b.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

l = A("l")
k = B("k")
m = C("m")
n = D("n")
b = E("b")

l.x = k
k.s = m
k.o = b
m.v = b
m.p = l
m.s = k
n.p = b
b.v = k
b.w = k
b.q = l
b.z = l
b.p = n
assert b.v.s.v.txt == "b"