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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: A = None
        self.t: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: A = None
        self.t: A = None
        self.p: D = None
        self.txt = txt

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

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

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

b.o = m
b.v = i
b.q = i
b.y = d
m.w = f
f.u = m
f.q = b
f.t = d
f.p = j
j.y = d
j.p = i
i.r = j
d.o = m
d.v = i
d.q = i
d.y = b
assert m.w.q.o.txt == "m"