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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: E = None
        self.w: A = None
        self.u: C = None
        self.y: E = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
j = C("j")
a = D("a")
k = E("k")

e.x = h
h.v = a
h.t = k
h.y = k
h.w = e
h.u = j
j.r = k
j.u = e
a.o = h
k.w = h
k.v = h
k.o = j
assert a.o.v.o.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: E = None
        self.w: A = None
        self.u: C = None
        self.y: E = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
j = C("j")
a = D("a")
k = E("k")

e.x = h
h.v = a
h.t = k
h.y = k
h.w = e
h.u = j
j.r = k
j.u = e
a.o = h
k.w = h
k.v = h
k.o = j
assert a.o.v.o.y.o.txt == "j"