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

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

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

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

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

j = A("j")
g = B("g")
d = C("d")
k = D("k")
m = E("m")

j.y = m
j.w = k
j.z = g
j.s = g
j.p = d
g.w = d
d.x = m
d.o = j
d.v = j
d.s = k
k.r = j
k.u = m
k.s = d
m.o = k
m.q = k
m.s = g
assert j.p.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: D = None
        self.z: B = None
        self.p: C = None
        self.s: B = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
d = C("d")
k = D("k")
m = E("m")

j.y = m
j.w = k
j.z = g
j.s = g
j.p = d
g.w = d
d.x = m
d.o = j
d.v = j
d.s = k
k.r = j
k.u = m
k.s = d
m.o = k
m.q = k
m.s = g
assert j.p.s.s.txt == "d"