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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: I = None
        self.r: B = None
        self.z: I = None
        self.x: H = None
        self.y: A = None
        self.p: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: H = None
        self.p: F = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: I = None
        self.r: B = None
        self.z: I = None
        self.x: H = None
        self.y: A = None
        self.p: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: H = None
        self.p: F = None
        self.s: C = None
        self.txt = txt

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

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