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

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

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

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

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

j = A("j")
e = B("e")
i = C("i")
f = D("f")
h = E("h")

j.w = h
j.u = h
j.s = e
e.r = j
i.r = j
f.t = i
f.q = j
f.p = h
h.v = f
h.x = f
h.y = e
h.q = i
assert i.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

j = A("j")
e = B("e")
i = C("i")
f = D("f")
h = E("h")

j.w = h
j.u = h
j.s = e
e.r = j
i.r = j
f.t = i
f.q = j
f.p = h
h.v = f
h.x = f
h.y = e
h.q = i
assert i.r.s.r.txt == "j"