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

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

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

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

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

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

j.s = h
l.r = g
l.x = a
l.q = j
f.s = h
f.y = g
g.r = k
g.o = k
g.w = f
g.t = a
k.u = l
k.z = f
k.q = j
i.r = k
i.o = k
i.w = f
i.t = l
a.r = i
a.x = l
a.q = h
h.s = j
assert j.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

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

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

j.s = h
l.r = g
l.x = a
l.q = j
f.s = h
f.y = g
g.r = k
g.o = k
g.w = f
g.t = a
k.u = l
k.z = f
k.q = j
i.r = k
i.o = k
i.w = f
i.t = l
a.r = i
a.x = l
a.q = h
h.s = j
assert j.s.s.s.s.txt == "j"