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

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

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

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

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

b = A("b")
m = B("m")
k = C("k")
f = D("f")
i = E("i")

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

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

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

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

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

b = A("b")
m = B("m")
k = C("k")
f = D("f")
i = E("i")

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