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

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

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

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

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

a = A("a")
k = B("k")
i = C("i")
g = D("g")
j = E("j")
m = A("m")

a.q = k
a.y = j
a.o = j
a.z = m
k.t = j
i.q = g
i.z = j
i.p = m
i.y = m
g.p = a
g.z = j
j.y = g
m.q = k
m.y = j
m.o = j
m.z = a
assert i.p.y.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.z: A = None
        self.o: E = None
        self.txt = txt

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

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

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

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

a = A("a")
k = B("k")
i = C("i")
g = D("g")
j = E("j")
m = A("m")

a.q = k
a.y = j
a.o = j
a.z = m
k.t = j
i.q = g
i.z = j
i.p = m
i.y = m
g.p = a
g.z = j
j.y = g
m.q = k
m.y = j
m.o = j
m.z = a
assert i.p.y.y.z.txt == "j"