class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: E = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.z: C = None
        self.x: B = None
        self.txt = txt

l = A("l")
i = B("i")
e = C("e")
h = D("h")
b = E("b")

l.x = h
l.w = h
l.s = b
i.v = h
i.p = h
e.v = b
h.r = b
h.o = l
h.p = i
b.r = i
b.x = i
b.q = h
b.z = e
assert h.r.q.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: E = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.z: C = None
        self.x: B = None
        self.txt = txt

l = A("l")
i = B("i")
e = C("e")
h = D("h")
b = E("b")

l.x = h
l.w = h
l.s = b
i.v = h
i.p = h
e.v = b
h.r = b
h.o = l
h.p = i
b.r = i
b.x = i
b.q = h
b.z = e
assert h.r.q.r.q.txt == "h"