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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.v: E = None
        self.y: F = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: F = None
        self.t: B = None
        self.y: C = None
        self.u: A = None
        self.txt = txt

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

m.v = h
k.y = i
k.t = a
f.r = h
f.v = a
f.y = i
f.s = b
b.z = l
a.r = l
a.t = h
l.x = m
l.r = h
h.z = b
h.w = i
h.t = k
h.y = f
h.u = m
c.r = h
c.v = a
c.y = i
c.s = b
i.x = m
i.r = h
assert f.v.t.y.r.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.v: E = None
        self.y: F = None
        self.s: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: F = None
        self.t: B = None
        self.y: C = None
        self.u: A = None
        self.txt = txt

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

m.v = h
k.y = i
k.t = a
f.r = h
f.v = a
f.y = i
f.s = b
b.z = l
a.r = l
a.t = h
l.x = m
l.r = h
h.z = b
h.w = i
h.t = k
h.y = f
h.u = m
c.r = h
c.v = a
c.y = i
c.s = b
i.x = m
i.r = h
assert f.v.t.y.r.t.y.txt == "i"