class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.o: D = None
        self.z: F = None
        self.r: H = None
        self.x: C = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.u: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.v: H = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.u: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.v: H = None
        self.w: E = None
        self.txt = txt

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

e.u = h
e.r = h
e.o = d
e.z = b
e.x = m
e.v = m
c.p = d
c.z = m
m.s = a
m.r = e
d.w = f
a.t = n
a.u = b
b.r = f
n.o = e
h.z = c
f.t = m
f.y = m
f.v = h
f.w = a
assert a.t.o.x.r.v.r.z.r.v.txt == "h"