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

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: B = None
        self.w: C = None
        self.t: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: A = None
        self.p: H = None
        self.y: C = None
        self.z: I = None
        self.q: G = None
        self.t: D = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: H = None
        self.w: H = None
        self.r: H = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: B = None
        self.w: C = None
        self.t: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: A = None
        self.p: H = None
        self.y: C = None
        self.z: I = None
        self.q: G = None
        self.t: D = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: H = None
        self.w: H = None
        self.r: H = None
        self.txt = txt

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

f.r = h
f.y = h
f.v = l
c.s = e
c.p = f
c.o = h
c.z = k
d.t = g
k.p = e
k.t = e
k.v = c
k.w = d
g.u = h
g.r = f
g.p = l
g.y = d
g.z = m
g.q = e
g.t = k
h.w = f
e.t = k
e.s = c
e.o = m
l.t = m
l.y = e
m.p = g
m.z = l
m.w = l
m.r = l
assert d.t.z.p.q.txt == "e"