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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: F = None
        self.o: E = None
        self.z: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: F = None
        self.y: B = None
        self.t: A = None
        self.x: G = None
        self.w: G = None
        self.txt = txt

i = A("i")
k = B("k")
l = C("l")
n = D("n")
h = E("h")
g = F("g")
b = G("b")
c = G("c")
a = B("a")
m = G("m")

i.y = b
i.r = n
k.x = g
k.y = i
k.w = i
k.r = i
k.t = m
l.t = k
l.r = k
n.r = h
n.o = h
n.p = g
n.z = l
h.p = g
h.z = i
h.q = l
h.w = n
g.w = c
b.q = i
b.t = i
b.s = g
b.y = k
b.x = m
b.w = c
c.q = i
c.t = i
c.s = g
c.y = k
c.x = m
c.w = b
a.x = g
a.y = i
a.w = i
a.r = i
a.t = m
m.q = i
m.t = i
m.s = g
m.y = k
m.x = c
m.w = b
assert m.s.w.t.y.t.r.p.w.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: F = None
        self.o: E = None
        self.z: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: F = None
        self.y: B = None
        self.t: A = None
        self.x: G = None
        self.w: G = None
        self.txt = txt

i = A("i")
k = B("k")
l = C("l")
n = D("n")
h = E("h")
g = F("g")
b = G("b")
c = G("c")
a = B("a")
m = G("m")

i.y = b
i.r = n
k.x = g
k.y = i
k.w = i
k.r = i
k.t = m
l.t = k
l.r = k
n.r = h
n.o = h
n.p = g
n.z = l
h.p = g
h.z = i
h.q = l
h.w = n
g.w = c
b.q = i
b.t = i
b.s = g
b.y = k
b.x = m
b.w = c
c.q = i
c.t = i
c.s = g
c.y = k
c.x = m
c.w = b
a.x = g
a.y = i
a.w = i
a.r = i
a.t = m
m.q = i
m.t = i
m.s = g
m.y = k
m.x = c
m.w = b
assert m.s.w.t.y.t.r.p.w.y.r.txt == "i"