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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.v: B = None
        self.u: E = None
        self.t: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: A = None
        self.s: G = None
        self.u: H = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: E = None
        self.p: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: C = None
        self.q: E = None
        self.s: E = None
        self.txt = txt

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

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

m.r = f
m.y = h
h.u = g
h.w = d
k.r = m
k.u = f
g.x = f
g.t = f
g.v = h
g.u = i
i.p = g
i.w = m
i.t = m
i.s = f
i.u = e
d.u = k
d.s = i
d.p = g
f.v = m
f.p = k
f.q = i
f.s = i
e.r = d
assert k.r.r.p.u.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.v: B = None
        self.u: E = None
        self.t: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: A = None
        self.s: G = None
        self.u: H = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: E = None
        self.p: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: C = None
        self.q: E = None
        self.s: E = None
        self.txt = txt

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

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

m.r = f
m.y = h
h.u = g
h.w = d
k.r = m
k.u = f
g.x = f
g.t = f
g.v = h
g.u = i
i.p = g
i.w = m
i.t = m
i.s = f
i.u = e
d.u = k
d.s = i
d.p = g
f.v = m
f.p = k
f.q = i
f.s = i
e.r = d
assert k.r.r.p.u.s.s.txt == "f"