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

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

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

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

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

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

b.w = c
b.q = j
j.x = b
m.v = b
h.v = m
e.t = m
e.q = m
e.v = c
c.v = m
assert h.v.v.q.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

b.w = c
b.q = j
j.x = b
m.v = b
h.v = m
e.t = m
e.q = m
e.v = c
c.v = m
assert h.v.v.q.x.q.x.txt == "b"