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

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: D = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: A = None
        self.txt = txt

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

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

f.o = d
b.s = k
b.p = j
b.w = g
b.v = f
b.r = c
a.q = g
a.y = h
a.u = k
j.w = h
j.z = f
c.p = f
c.z = d
c.w = h
k.p = f
k.z = d
k.w = j
h.w = j
h.z = f
d.s = c
d.p = h
d.w = g
d.v = f
d.r = k
g.q = a
g.y = h
g.u = c
assert k.z.p.z.o.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: D = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: A = None
        self.txt = txt

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

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

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