class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: D = None
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: A = None
        self.w: D = None
        self.q: D = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
l = C("l")
m = D("m")
b = E("b")

d.q = h
d.t = h
d.z = m
d.v = m
h.v = b
h.r = d
h.s = m
h.y = m
l.v = m
l.w = m
l.q = m
l.r = d
m.o = h
m.w = h
m.y = d
m.z = b
b.o = h
b.r = l
assert l.r.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: D = None
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: A = None
        self.w: D = None
        self.q: D = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
l = C("l")
m = D("m")
b = E("b")

d.q = h
d.t = h
d.z = m
d.v = m
h.v = b
h.r = d
h.s = m
h.y = m
l.v = m
l.w = m
l.q = m
l.r = d
m.o = h
m.w = h
m.y = d
m.z = b
b.o = h
b.r = l
assert l.r.t.y.txt == "m"