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

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

class C:
    def __init__(self, txt: str):
        self.r: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.v: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: E = None
        self.z: A = None
        self.q: I = None
        self.o: C = None
        self.r: I = None
        self.s: C = None
        self.w: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: B = None
        self.z: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.v: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: E = None
        self.z: A = None
        self.q: I = None
        self.o: C = None
        self.r: I = None
        self.s: C = None
        self.w: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: B = None
        self.z: D = None
        self.txt = txt

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

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