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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: F = None
        self.r: G = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: A = None
        self.v: A = None
        self.r: I = None
        self.txt = txt

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

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

d.p = b
d.x = b
d.z = a
d.s = g
d.u = m
c.q = g
g.u = c
g.s = m
g.r = l
k.r = l
k.s = b
b.y = k
b.z = c
b.o = l
m.z = d
l.w = d
l.q = c
i.s = l
i.z = d
i.v = d
i.r = a
a.w = l
assert i.z.z.w.q.q.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: I = None
        self.x: E = None
        self.s: C = None
        self.u: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: F = None
        self.r: G = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: A = None
        self.v: A = None
        self.r: I = None
        self.txt = txt

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

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

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