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

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

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

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

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

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

l.q = m
l.w = j
l.r = h
h.x = b
b.v = m
b.o = l
m.u = j
m.o = h
m.p = b
j.p = h
j.r = m
j.v = b
assert m.p.v.o.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

l.q = m
l.w = j
l.r = h
h.x = b
b.v = m
b.o = l
m.u = j
m.o = h
m.p = b
j.p = h
j.r = m
j.v = b
assert m.p.v.o.x.o.txt == "l"