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

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

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

class D:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: A = None
        self.o: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: E = None
        self.x: B = None
        self.txt = txt

k = A("k")
a = B("a")
l = C("l")
n = D("n")
f = E("f")
d = F("d")
g = G("g")
c = H("c")
m = I("m")

k.x = n
k.s = a
a.o = f
a.p = d
a.u = n
l.x = n
n.t = c
f.r = a
f.w = k
f.o = g
d.w = k
d.o = l
d.p = l
d.u = l
d.v = f
d.r = n
d.s = g
g.y = a
c.x = k
c.s = k
c.o = m
m.q = n
m.y = f
m.x = a
assert k.x.t.o.q.t.o.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: A = None
        self.o: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: E = None
        self.x: B = None
        self.txt = txt

k = A("k")
a = B("a")
l = C("l")
n = D("n")
f = E("f")
d = F("d")
g = G("g")
c = H("c")
m = I("m")

k.x = n
k.s = a
a.o = f
a.p = d
a.u = n
l.x = n
n.t = c
f.r = a
f.w = k
f.o = g
d.w = k
d.o = l
d.p = l
d.u = l
d.v = f
d.r = n
d.s = g
g.y = a
c.x = k
c.s = k
c.o = m
m.q = n
m.y = f
m.x = a
assert k.x.t.o.q.t.o.y.r.txt == "a"