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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: A = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: A = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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