class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: C = None
        self.r: E = None
        self.txt = txt

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

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

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

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

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

i.o = l
i.p = l
i.r = j
k.v = l
k.x = l
l.y = j
l.z = i
b.y = j
b.u = k
b.s = l
j.s = k
j.r = l
assert k.x.y.s.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: C = None
        self.r: E = None
        self.txt = txt

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

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

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

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

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

i.o = l
i.p = l
i.r = j
k.v = l
k.x = l
l.y = j
l.z = i
b.y = j
b.u = k
b.s = l
j.s = k
j.r = l
assert k.x.y.s.x.y.txt == "j"