class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: C = None
        self.w: C = 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.s: E = None
        self.v: A = None
        self.z: E = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
g = C("g")
i = D("i")
a = E("a")

j.r = i
j.s = g
j.w = g
k.x = j
g.s = a
g.z = a
g.v = j
i.w = k
i.p = k
a.q = j
a.r = j
a.u = i
a.x = g
a.o = g
assert g.v.s.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: C = None
        self.w: C = 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.s: E = None
        self.v: A = None
        self.z: E = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
g = C("g")
i = D("i")
a = E("a")

j.r = i
j.s = g
j.w = g
k.x = j
g.s = a
g.z = a
g.v = j
i.w = k
i.p = k
a.q = j
a.r = j
a.u = i
a.x = g
a.o = g
assert g.v.s.s.x.txt == "g"