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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: A = 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.o: B = None
        self.w: B = None
        self.q: D = None
        self.txt = txt

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

k = A("k")
d = B("d")
b = C("b")
j = D("j")
h = E("h")
a = D("a")

k.q = a
k.o = d
k.s = d
k.v = h
d.o = h
d.y = k
b.s = d
j.o = d
j.w = d
j.q = a
h.p = k
h.z = k
h.v = b
h.q = b
h.y = d
a.o = d
a.w = d
a.q = j
assert j.o.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.s: B = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: A = 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.o: B = None
        self.w: B = None
        self.q: D = None
        self.txt = txt

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

k = A("k")
d = B("d")
b = C("b")
j = D("j")
h = E("h")
a = D("a")

k.q = a
k.o = d
k.s = d
k.v = h
d.o = h
d.y = k
b.s = d
j.o = d
j.w = d
j.q = a
h.p = k
h.z = k
h.v = b
h.q = b
h.y = d
a.o = d
a.w = d
a.q = j
assert j.o.y.q.txt == "a"