class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: D = None
        self.p: H = None
        self.y: B = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: C = None
        self.y: E = None
        self.z: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: H = None
        self.z: B = None
        self.x: C = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: I = None
        self.p: E = None
        self.txt = txt

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

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

b = A("b")
g = B("g")
d = C("d")
n = D("n")
i = E("i")
k = F("k")
a = G("a")
h = H("h")
l = I("l")
e = C("e")

b.v = k
b.s = k
b.w = n
b.p = h
b.y = g
g.u = k
g.x = d
g.y = i
g.z = l
d.p = a
d.y = i
n.o = i
n.q = l
i.z = b
k.s = n
k.v = h
k.z = g
k.x = e
k.w = d
a.s = n
a.y = l
a.p = i
h.y = b
l.w = a
l.r = a
l.q = n
e.p = a
e.y = i
assert k.x.y.z.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: D = None
        self.p: H = None
        self.y: B = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: C = None
        self.y: E = None
        self.z: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: H = None
        self.z: B = None
        self.x: C = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: I = None
        self.p: E = None
        self.txt = txt

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

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

b = A("b")
g = B("g")
d = C("d")
n = D("n")
i = E("i")
k = F("k")
a = G("a")
h = H("h")
l = I("l")
e = C("e")

b.v = k
b.s = k
b.w = n
b.p = h
b.y = g
g.u = k
g.x = d
g.y = i
g.z = l
d.p = a
d.y = i
n.o = i
n.q = l
i.z = b
k.s = n
k.v = h
k.z = g
k.x = e
k.w = d
a.s = n
a.y = l
a.p = i
h.y = b
l.w = a
l.r = a
l.q = n
e.p = a
e.y = i
assert k.x.y.z.v.w.txt == "d"