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

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

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

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

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

j = A("j")
g = B("g")
d = C("d")
l = D("l")
h = E("h")

j.p = l
j.v = d
j.x = d
g.u = h
g.t = h
g.s = j
d.r = h
d.p = h
d.t = j
d.z = j
l.w = d
l.s = d
l.v = g
l.r = g
l.p = j
h.v = d
h.r = j
h.q = j
h.p = l
assert j.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: C = None
        self.x: C = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
d = C("d")
l = D("l")
h = E("h")

j.p = l
j.v = d
j.x = d
g.u = h
g.t = h
g.s = j
d.r = h
d.p = h
d.t = j
d.z = j
l.w = d
l.s = d
l.v = g
l.r = g
l.p = j
h.v = d
h.r = j
h.q = j
h.p = l
assert j.v.t.v.txt == "d"