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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: B = None
        self.u: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.t: A = None
        self.q: H = None
        self.x: D = None
        self.r: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: A = None
        self.t: F = None
        self.w: E = None
        self.u: E = None
        self.y: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: A = None
        self.t: E = None
        self.u: D = None
        self.x: B = None
        self.p: D = None
        self.v: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

a.t = n
a.o = f
g.y = b
g.r = b
g.u = k
h.p = n
h.r = n
h.t = a
h.q = k
h.x = m
e.r = m
e.v = a
e.y = a
e.t = f
e.w = d
e.u = d
d.t = h
d.z = m
d.p = f
d.q = f
d.u = k
f.y = e
f.u = e
f.p = e
f.q = a
f.t = d
f.x = g
f.v = m
n.w = f
k.o = f
b.y = g
b.r = g
b.u = k
m.r = e
m.v = a
m.y = a
m.t = f
m.w = d
m.u = d
assert m.t.x.y.u.o.x.y.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: B = None
        self.u: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.t: A = None
        self.q: H = None
        self.x: D = None
        self.r: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: A = None
        self.t: F = None
        self.w: E = None
        self.u: E = None
        self.y: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: A = None
        self.t: E = None
        self.u: D = None
        self.x: B = None
        self.p: D = None
        self.v: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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