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

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

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

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

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

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

j.x = c
j.q = l
b.w = h
b.z = l
b.o = l
b.q = j
c.v = h
l.u = i
l.r = j
l.x = j
l.s = b
i.w = j
i.q = l
h.w = b
h.z = l
h.o = l
h.q = j
assert c.v.z.s.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

j.x = c
j.q = l
b.w = h
b.z = l
b.o = l
b.q = j
c.v = h
l.u = i
l.r = j
l.x = j
l.s = b
i.w = j
i.q = l
h.w = b
h.z = l
h.o = l
h.q = j
assert c.v.z.s.q.x.txt == "c"