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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: A = None
        self.u: D = None
        self.v: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

k.q = i
k.x = g
k.r = a
k.p = m
a.t = g
a.s = k
a.u = m
a.y = m
a.v = i
g.v = i
m.y = g
i.o = a
i.y = k
assert i.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: C = None
        self.r: B = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: A = None
        self.u: D = None
        self.v: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

k.q = i
k.x = g
k.r = a
k.p = m
a.t = g
a.s = k
a.u = m
a.y = m
a.v = i
g.v = i
m.y = g
i.o = a
i.y = k
assert i.y.q.y.txt == "k"