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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.t: B = None
        self.o: D = None
        self.z: A = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
c = C("c")
h = D("h")
k = E("k")
d = B("d")
a = A("a")
f = C("f")

j.o = a
j.t = f
j.r = h
g.q = d
g.t = d
g.r = f
g.o = h
g.z = j
c.y = j
h.q = g
h.z = k
h.s = f
k.s = f
k.w = c
d.q = g
d.t = g
d.r = c
d.o = h
d.z = a
a.o = j
a.t = f
a.r = h
f.y = a
assert g.z.o.t.y.r.z.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: C = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.t: B = None
        self.o: D = None
        self.z: A = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
c = C("c")
h = D("h")
k = E("k")
d = B("d")
a = A("a")
f = C("f")

j.o = a
j.t = f
j.r = h
g.q = d
g.t = d
g.r = f
g.o = h
g.z = j
c.y = j
h.q = g
h.z = k
h.s = f
k.s = f
k.w = c
d.q = g
d.t = g
d.r = c
d.o = h
d.z = a
a.o = j
a.t = f
a.r = h
f.y = a
assert g.z.o.t.y.r.z.w.y.txt == "j"