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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: A = None
        self.x: H = None
        self.u: H = None
        self.z: B = None
        self.v: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: B = None
        self.x: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: E = None
        self.t: C = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: A = None
        self.w: E = None
        self.z: E = None
        self.u: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: A = None
        self.x: H = None
        self.u: H = None
        self.z: B = None
        self.v: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: B = None
        self.x: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: E = None
        self.t: C = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: A = None
        self.w: E = None
        self.z: E = None
        self.u: B = None
        self.txt = txt

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

m.r = n
k.t = c
h.q = k
h.r = c
h.w = c
c.s = h
c.y = m
c.x = g
c.u = g
c.v = g
c.z = k
i.w = g
i.q = k
i.x = n
n.u = i
e.o = g
e.u = i
e.t = h
e.r = h
g.x = m
g.t = m
g.w = i
g.z = i
g.u = k
assert i.w.z.x.u.q.t.txt == "c"