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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: H = None
        self.z: F = None
        self.u: F = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: G = None
        self.s: E = None
        self.x: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.y: D = None
        self.v: D = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: B = None
        self.z: B = None
        self.t: I = None
        self.x: E = None
        self.txt = txt

f = A("f")
b = B("b")
k = C("k")
h = D("h")
d = E("d")
j = F("j")
m = G("m")
a = H("a")
i = I("i")
l = J("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: H = None
        self.z: F = None
        self.u: F = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: G = None
        self.s: E = None
        self.x: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.y: D = None
        self.v: D = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: B = None
        self.z: B = None
        self.t: I = None
        self.x: E = None
        self.txt = txt

f = A("f")
b = B("b")
k = C("k")
h = D("h")
d = E("d")
j = F("j")
m = G("m")
a = H("a")
i = I("i")
l = J("l")

f.w = i
f.r = h
b.v = h
b.x = k
b.r = d
b.w = i
k.o = h
h.o = k
h.s = a
h.z = j
h.u = j
h.p = f
d.p = j
d.w = b
j.t = d
j.s = d
j.w = m
j.x = f
j.o = h
j.r = h
m.u = a
m.w = b
a.q = f
a.z = f
a.p = b
a.o = b
a.y = h
a.v = h
i.r = h
i.y = a
l.p = k
l.o = b
l.z = b
l.t = i
l.x = d
assert i.r.z.x.w.r.o.o.o.o.o.txt == "k"